带有s2成员和Amazon s3/CloudFront的JW播放器弹出窗口

时间:2013-11-24 作者:Abdul Awal Uzzal

我一直在开发一个教程网站。我正在使用WordPress、ACF、s2member、amazon s3&;cloudfront和JW播放器。

我已经将amazon cloudfront与s2member集成,但现在我在JW播放器中播放视频时遇到了问题。实际上,我想在新窗口中打开视频播放器。我将为教程使用自定义帖子类型。然后自定义视频名称字段(&A);链接。

有人能帮我找到一种在新窗口播放视频的方法吗。下面是我需要做的具体演示:http://www.vtc.com/products/MasterClass!-Cinema-4D-Lite-in-Adobe-After-Effects-CC-Workflow-Tutorials.htm

如果单击输入设备,您将看到视频在新窗口中打开。

以下是我的网站:http://demo.mamb2b.us/training/courses/photoshop-course-1/

这是我的单门课程。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\'); ?>
提前感谢您的帮助!

1 个回复
最合适的回答,由SO网友:Abdul Awal Uzzal 整理而成

我已经在某种程度上解决了这个问题。如果它对其他人有帮助,我将与大家分享我是如何修复的。。

我已经创建了一个新的页面模板&;page call播放视频,其中我调用了空页眉、页脚和;车身部分。仅s2member函数用于使用jwplayer播放视频。我保留了视频链接以使用GET方法。

然后,从单一课程页面,我将视频链接到mysite。com/视频/?video\\u name=我的视频。mp4和;在新窗口中打开页面的onclick函数。。

结束