JW Player popup with s2member & amazon s3/cloudfront

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')) : ?
        trh2Introduction/h2/tr
        tr
            thName/th
            th/th
            thDuration/th
            thFiles/th
        /tr

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

        tr
            tda href="javascript:;" id="introduction?php the_sub_field('sl._no.'); ?"?php the_sub_field('name'); ?/a/td
            tda 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')) : ?
        trtdh2Basic/h2/td/tr


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

        tr
            tda href="?php the_sub_field('video_link'); ?"?php the_sub_field('name'); ?/a/td
            tda 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')) : ?
        trtdh2Basic/h2/td/tr


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

        tr
            tdspan title="You must be a premium user to view this tutorial"?php the_sub_field('name'); ?/span/td
            tdimg 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')) : ?
        trtdh2Advanced/h2/td/tr

        ?php while(has_sub_field('advanced')) : ?
        tr
            tda 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
            tda 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')) : ?
        trtdh2Advanced/h2/td/tr

        ?php while(has_sub_field('advanced')) : ?
        tr
            tdspan title="You must be a premium user to view this tutorial"?php the_sub_field('name'); ?/span/td
            tdimg 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"
        h2Course 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!

Topic s2member amazon Wordpress

Category Web


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..

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.