PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

Download Options example with playlist?

s2Member Plugin. A Membership plugin for WordPress®.

Download Options example with playlist?

Postby tripleaaadelay » December 9th, 2011, 3:39 am

Hi guys,

I'm looking at the "JW Player® ( RTMP streaming MP4, via s2Member's Amazon® S3/CloudFront integration )" configuration. Is the code in RED what I should be replacing with my specifics? Can you give me an example of how I would adjust this code?

Also, how can I use this code with a playlist instead of an mp4?

Thx!

Code below:


Code: Select all
<div id="jw-container">JW Player® appears here.</div>
<script type="text/javascript" src="/jwplayer/jwplayer.js"></script>

<?php /* A direct URL to the RTMP source; counting the file against the current User in real-time. */
$cfg = array ("[color=#FF0000]file_download[/color]" => "[color=#FF0000]video.mp4[/color]", "[color=#FF0000]url_to_storage_source[/color]" => true, "[color=#FF0000]count_against_user[/color]" => 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, "[color=#FF0000]get-streamer-array[/color]"))) { ?>

    <script type="text/javascript">
        jwplayer("jw-container").setup({modes: /* JW Player®. */
        [
            /* First try real-time streaming with Flash® player. */
            {type: "flash", provider: "rtmp", src: "/jwplayer/player.swf",
                config: {streamer: "<?php echo $mp4["[color=#FF0000]streamer[/color]"]; ?>", file: "<?php echo $mp4["[color=#FF0000]file[/color]"]; ?>"}},
        
            /* Else, try an HTML5 video tag. */
            {type: "html5", provider: "video",
                config: {file: "<?php echo $mp4["[color=#FF0000]url[/color]"]; ?>"}},
        
            /* Else, this is a safe fallback. */
            {type: "download", /* Download the file. */
                config: {file: "<?php echo $mp4["[color=#FF0000]url[/color]"]; ?>"}}
        ],
        /* Set video dimensions. */ width: 480, height: 270
        });
    </script>

<?php } else /* Access is denied to the current User. */ { ?>
    Sorry, you do NOT have access to this file.
<?php } ?>
Last edited by Cristián Lávaque on December 10th, 2011, 3:16 pm, edited 1 time in total.
Reason: Improve code readability. http://www.primothemes.com/forums/viewtopic.php?f=36&t=2780
User avatar
tripleaaadelay
Registered User
Registered User
 
Posts: 42
Joined: August 17, 2011

Re: Download Options example with playlist?

Postby Jason Caldwell » December 15th, 2011, 7:34 pm

Thanks for your inquiry.
This code sample that you posted seems to have gotten corrupted.
You can find full valid code samples inside your Dashboard, under:
s2Member -> Download Options -> JW Player Examples

In this valid example code below, you will just need to change the file name of the video. So swap out video.mp4 with the name of your video, and swap /jwplayer/player.swf with the actual location of JW Player on your site.
Code: Select all
[HR][/HR]<div id="jw-container">JW Player® appears here.</div>
<script type="text/javascript" src="/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" => "video.mp4", "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({modes: /* JW Player®. */
        [
            /* First try real-time streaming with Flash® player. */
            {type: "flash", provider: "rtmp", src: "/jwplayer/player.swf",
                config: {streamer: "<?php echo $mp4["streamer"]; ?>", file: "<?php echo $mp4["file"]; ?>"}},
        
            /* Else, try an HTML5 video tag. */
            {type: "html5", provider: "video",
                config: {file: "<?php echo $mp4["url"]; ?>"}},
        
            /* Else, this is a safe fallback. */
            {type: "download", /* Download the file. */
                config: {file: "<?php echo $mp4["url"]; ?>"}}
        ],
        /* Set video dimensions. */ width: 480, height: 270
        });
    </script>

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



<div id="jw-container">JW Player® appears here.</div>
<script type="text/javascript" src="/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" => "video.mp4", "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({modes: /* JW Player®. */
[
/* First try real-time streaming with Flash® player. */
{type: "flash", provider: "rtmp", src: "/jwplayer/player.swf",
config: {streamer: "<?php echo $mp4["streamer"]; ?>", file: "<?php echo $mp4["file"]; ?>"}},


Reference articles that might be of some assistance:
http://wordpress.org/extend/plugins/jw- ... wordpress/
http://www.longtailvideo.com/support/jw ... -reference
http://www.longtailvideo.com/support/jw ... the-player
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA


Return to s2Member Plugin

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot] and 2 guests

cron