Home Forums Plugin Support WP User Frontend Pro JW Player and WPUFP

This topic is: resolved

This topic contains 8 replies, has 2 voices, and was last updated by  Tareq Hasan 5 years, 8 months ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #9017

    Ben
    Participant
    Post count: 10

    Hi There,
    I have a project which uses custom posts to present media files which are uploaded through the wordpress media uploader. I purchased the plugin after playing with the free version and it's excellent, the one problem is that the pro version doesnt use the standard WP media uploader.

    Basically I need it to upload to the site and output the file url like: [video width="1280" height="720" mp4="http://sitename/wp-content/uploads/2013/10/filename.mp4"][/video]

    Would you be able to recommend the best way around this?

    Thanks in advance,

    Ben

    #9034

    Tareq Hasan
    Keymaster
    Post count: 2831

    May be you should edit your themes single.php to show the video like this:
    [php]
    $video_id = get_post_meta( $post->ID, ‘your_video_meta', true );
    $url = wp_get_attachment_url( $video_id );
    echo do_shortcode( ‘[video width="1280" height="720" mp4="' . $url . '"][/video]‘ );
    [/php]

    #9069

    Ben
    Participant
    Post count: 10

    Hi There,

    Thanks for the reply. I tried this but I dont think it's working. Here's the code I'm using to call the video in the template, would you be able to suggest how I change it?

    It was working perfectly with the free plugin.

    Thanks
    B

    < ?php while ( $resource_video->have_posts() ) : $resource_video->the_post(); // Check for our video ?>

    Video player loads here.

    < ?php endwhile; ?>

    #9070

    Ben
    Participant
    Post count: 10

    Sorry, code truncated, full version here:

    				<?php while ( $resource_video->have_posts() ) : $resource_video->the_post(); // Check for our video ?>
    					<div id="player">
    						<script type="text/javascript" src="<?php bloginfo('stylesheet_directory'); ?>/jw/jwplayer.js"></script>
    						<div id="mediaspace">Video player loads here.</div>
    						<script type="text/javascript">
    						    jwplayer("mediaspace").setup({
    						        flashplayer: '<?php bloginfo( 'stylesheet_directory' ); ?>/jw/player.swf',
    						        file: '<?php echo $post->guid; ?>',
    						        width: 640,
    						        height: 360
    						    });
    						</script>
    					</div>
    				<?php endwhile; ?>
    #9149

    Tareq Hasan
    Keymaster
    Post count: 2831

    Put this code in the WordPress loop.
    [php]
    $video_id = get_post_meta( $post->ID, ‘your_video_meta', true );
    $url = wp_get_attachment_url( $video_id );
    [/php]

    Now print the url in the jw player JavaScript code.
    [js]file: ‘<?php echo $url; ?>',[/js]

    #9182

    Ben
    Participant
    Post count: 10

    I'm really sorry but I cant get this one to work with the meta, would you be able to give a more complete example based on the code I provided?

    Thanks again, your help is much appreciated.

    Ben

    #9185

    Tareq Hasan
    Keymaster
    Post count: 2831

    Here's the complete code:

    [php]
    <?php while ( $resource_video->have_posts() ) : $resource_video->the_post(); // Check for our video ?>
    <div id="player">
    <script type="text/javascript" src="<?php bloginfo(‘stylesheet_directory'); ?>/jw/jwplayer.js"></script>
    <div id="mediaspace">Video player loads here.</div>
    <script type="text/javascript">
    <?php
    $video_id = get_post_meta( $post->ID, ‘your_video_meta', true );
    $url = wp_get_attachment_url( $video_id );
    ?>
    jwplayer("mediaspace").setup({
    flashplayer: ‘<?php bloginfo( ‘stylesheet_directory' ); ?>/jw/player.swf',
    file: ‘<?php echo $url; ?>',
    width: 640,
    height: 360
    });
    </script>
    </div>
    <?php endwhile; ?>
    [/php]

    #9187

    Ben
    Participant
    Post count: 10

    Thanks Tareq,

    It's not done the trick, I think there might be some conflicting stuff in the loop section above. It's using the custom post type ‘resource'.

    Any idea what the problem might be?

    
    <?php get_header(); ?>
    
    <?php // Let's get the data we need
    	$recording_date = get_post_meta( $post->ID, 'recording_date', true );
    	$recording_length = get_post_meta( $post->ID, 'recording_length', true );
    	$resource_presenters = get_the_term_list( $post->ID, 'presenters', '', ', ', '' );
    	$resource_topics = get_the_term_list( $post->ID, 'topics', '', ', ', '' );
    	$url = wp_get_attachment_url( $video_id );
    	$resource_video = new WP_Query( // Start a new query for our videos
    	array(
    		'post_parent' => $post->ID, // Get data from the current post
    		'post_type' => 'attachment', // Only bring back attachments
    		'post_mime_type' => 'video', // Only bring back attachments that are videos
    		'posts_per_page' => '1', // Show us the first result
    		'post_status' => 'inherit', // Attachments require "inherit" or "all"
    		)
    	);
    	$video_id = get_post_meta( $post->ID, 'your_video_meta', true );
    	$url = wp_get_attachment_url( $video_id );
    
    ?>
    

    I really appreciate the support, when we get this sorted please could you point me to your preferred link for me to rate and review.

    Kind regards,

    Ben

    #9189

    Tareq Hasan
    Keymaster
    Post count: 2831

    Are you providing the right meta key? I am using a sample key named your_video_meta. Make sure you are replacing this with your own meta key that is being used in the post.

    You can paste the whole code in pastebin.com for better idea what you are trying to do.

Viewing 9 posts - 1 through 9 (of 9 total)

The topic ‘JW Player and WPUFP’ is closed to new replies.