0

I have been working on Developing a Tutorial site. I am using WordPress, ACF, s2member, amazon s3 & cloudfront and JW Player.

I have integrated amazon cloudfront with s2member but now I am having problem to play video in JW Player. I actually want to open the video player in a new window. I am going to use a custom post type for tutorials. Then custom field for Video name & links.

Can anybody help me find a way to play the video in a new window. Here is an exact demo of what I need to do : http://www.vtc.com/products/MasterClass!-Cinema-4D-Lite-in-Adobe-After-Effects-CC-Workflow-Tutorials.htm

If you click on Input Devices, you will see the video open in a new window.

Here is my site : http://demo.mamb2b.us/training/courses/photoshop-course-1/

And here is my single-courses.php ::

get_header('courses'); ?>



    <?php

    /* Run the loop to output the posts.

     * If you want to overload this in a child theme then include a file

     * called loop-single.php and that will be used instead.

     */

    the_post();


    //get_template_part('loop', 'single');

    ?>

<div class="course_details_box">
     <?php do_action('icl_language_selector'); ?>
    <table>
        <?php if(get_field('introduction')) : ?>
        <tr><h2>Introduction</h2></tr>
        <tr>
            <th>Name</th>
            <th></th>
            <th>Duration</th>
            <th>Files</th>
        </tr>

        <?php while(has_sub_field('introduction')) : ?>

        <tr>
            <td><a href="javascript:;" id="introduction<?php the_sub_field('sl._no.'); ?>"><?php the_sub_field('name'); ?></a></td>
            <td><a rel="shadowbox" href="#introduction<?php the_sub_field('sl._no.'); ?>"><img src="http://demo.mamb2b.us/training/wp-content/uploads/2013/11/Play-Button.png" class="play_btn" width="20"/></a></td>
            <td><?php the_sub_field('duration'); ?></td>
            <td></td>
        </tr>
        <!--div id="#introduction<?php the_sub_field('sl._no.'); ?>" class="">
            <?php
// Configuration.
$s2_jw_config["jwplayer"] = "/jwplayer/"; // Relative URL path to JW Player files directory.
$s2_jw_config["mp4_video_file_name"] = get_sub_field("video_link"); // Name of your MP4 test file.
// Don't edit anything else below unless you know what you're doing.
?>

<div id="jw-container">JW Player® appears here.</div>
<script type="text/javascript" src="<?php echo $s2_jw_config["jwplayer"]; ?>jwplayer.js"></script>

<?php // A direct URL to the RTMP source; counting the file against the current User in real-time.
$cfg = array ("file_download" => $s2_jw_config["mp4_video_file_name"], "url_to_storage_source" => true, "count_against_user" => true); ?>

<?php // API Function `s2member_file_download_url()` returns false if access is denied to the current User.
if (($mp4 = s2member_file_download_url ($cfg, "get-streamer-array"))) { ?>

    <script type="text/javascript">
        jwplayer('jw-container').setup({
                playlist:
                    [{
                        sources: // List all available sources.
                            [
                                {type: 'rtmp', file: '<?php echo $mp4["streamer"]; ?>/mp4:<?php echo $mp4["file"]; ?>'},
                                {type: 'mp4', file: '<?php echo $mp4["url"]; ?>'}
                            ]
                    }],
                primary: 'flash' /* Try Flash® RTMP first, fallback on HTML5 or direct download of MP4 file. */,
                width: 480, height: 270 // Set video dimensions for all sources.
            });
    </script>

<?php } else /* Access is denied to the current User. */ { ?>
    Sorry, you do NOT have access to this file.
<?php } ?>
        </div -->
    <?php endwhile; 
    endif; 
    ?>

        <!-- Basic Part -->
        <?php if (current_user_is("s2member_level1")){ ?>
        <?php if(get_field('basic_tutorial')) : ?>
        <tr><td><h2>Basic</h2></td></tr>


        <?php while(has_sub_field('basic_tutorial')) : ?>

        <tr>
            <td><a href="<?php the_sub_field('video_link'); ?>"><?php the_sub_field('name'); ?></a></td>
            <td><a href="<?php the_sub_field('video_link'); ?>"><img src="http://demo.mamb2b.us/training/wp-content/uploads/2013/11/Play-Button.png" class="play_btn" width="20"/></a></td>
            <td><?php the_sub_field('duration'); ?></td>
            <td></td>
        </tr>
    <?php endwhile; 
    endif; 
    ?>
    <?php } else { ?>
<?php if(get_field('basic_tutorial')) : ?>
        <tr><td><h2>Basic</h2></td></tr>


        <?php while(has_sub_field('basic_tutorial')) : ?>

        <tr>
            <td><span title="You must be a premium user to view this tutorial"><?php the_sub_field('name'); ?></span></td>
            <td><img title="You must be a premium user to view this tutorial" src="http://demo.mamb2b.us/training/wp-content/uploads/2013/11/Play-Button.png" class="play_btn" width="20"/></td>
            <td><?php the_sub_field('duration'); ?></td>
            <td></td>
        </tr>
    <?php endwhile; 
    endif; 
    ?>
    <?php } ?>

        <!-- Advanced Part -->
        <?php if (current_user_is("s2member_level1")){ ?>
        <?php if(get_field('advanced')) : ?>
        <tr><td><h2>Advanced</h2></td></tr>

        <?php while(has_sub_field('advanced')) : ?>
        <tr>
            <td><a href="javascript:void(0)" onclick="window.open('http://www.w3schools.com/html/movie.mp4<?php //the_sub_field('video_link'); ?>',
'welcome','scrollbars=yes,location=no, toolbar=no')"><?php the_sub_field('name'); ?></a></td>
            <td><a href="<?php the_sub_field('video_link'); ?>"><img src="http://demo.mamb2b.us/training/wp-content/uploads/2013/11/Play-Button.png" class="play_btn" width="20"/></a></td>
            <td><?php the_sub_field('duration'); ?></td>
            <td></td>
        </tr>
    <?php endwhile; 
    endif; 
    ?>
    <?php } else { ?>

    <?php if(get_field('advanced')) : ?>
        <tr><td><h2>Advanced</h2></td></tr>

        <?php while(has_sub_field('advanced')) : ?>
        <tr>
            <td><span title="You must be a premium user to view this tutorial"><?php the_sub_field('name'); ?></span></td>
            <td><img title="You must be a premium user to view this tutorial" src="http://demo.mamb2b.us/training/wp-content/uploads/2013/11/Play-Button.png" class="play_btn" width="20"/></td>
            <td><?php the_sub_field('duration'); ?></td>
            <td></td>
        </tr>
    <?php endwhile; 
    endif; 
    ?>
    <?php } ?>
    </table>
</div> <!-- /.course-detials-box -->

<div class="course_right_part">
    <div class="course_desc">
        <h2>Course Description:</h2>
        <p><?php the_content(); ?></p>

    </div>
    <?php //comments_template(); ?>
    <?php echo do_shortcode('[facebookall_comments]'); ?>
<!--      <input type="text" width="" value="Post comment using your facebook account" />
 --></div>
<?php get_footer('courses'); ?>

Thanks in Advance for your Help!

  • Please ask me if you have any question about my requirement. I am checking it always.. – Abdul Awal Nov 24 '13 at 18:35
  • Can you achieve this in proof of concept fashion sans WP bits? What do you need to happen to have it work with JW Player, since it has little to do with WP by itself? – Rarst Nov 24 '13 at 20:21
0

I have fixed this in a way. I am going to share how I have fixed if it helps someone else ..

I have created a new page template & page call Play Video where I have called empty header, footer & body section. Only the s2member function for playing video with jwplayer. I kept the video link to use GET method.

Then, From Single courses page, I have linked the videos with mysite.com/video/?video_name=myvideo.mp4 & an onclick function to open the page in a new window..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.