| 1 |
<div id="jw-container">JW Player® appears here.</div> |
| 2 |
<script type="text/javascript" src="/jwplayer/jwplayer.js"></script> |
| 3 |
|
| 4 |
<?php /* A direct URL to the RTMP source; counting the file against the current User in real-time. */ |
| 5 |
$mp4_cfg = array ("file_download" => "video.mp4", "url_to_storage_source" => true, "count_against_user" => true); |
| 6 |
$webm_cfg = array ("file_download" => "video.webm", "url_to_storage_source" => true /* Don't count variations. */); ?> |
| 7 |
|
| 8 |
<?php /* API Function `s2member_file_download_url()` returns false if access is denied to the current User. */ |
| 9 |
if (($mp4 = s2member_file_download_url ($mp4_cfg, "get-streamer-array")) |
| 10 |
&& ($webm["url"] = s2member_file_download_url ($webm_cfg))) { ?> |
| 11 |
|
| 12 |
<script type="text/javascript"> |
| 13 |
jwplayer("jw-container").setup({modes: /* JW Player®. */ |
| 14 |
[ |
| 15 |
/* First try real-time streaming with Flash® player. */ |
| 16 |
{type: "flash", provider: "rtmp", src: "/jwplayer/player.swf", |
| 17 |
config: {streamer: "<?php echo $mp4["streamer"]; ?>", file: "<?php echo $mp4["file"]; ?>"}}, |
| 18 |
|
| 19 |
/* Else, try an HTML5 video tag with the `mp4` file. */ |
| 20 |
{type: "html5", provider: "video", |
| 21 |
config: {file: "<?php echo $mp4["url"]; ?>"}}, |
| 22 |
|
| 23 |
/* Else, try an HTML5 video tag with a `webm` file. */ |
| 24 |
{type: "html5", provider: "video", |
| 25 |
config: {file: "<?php echo $webm["url"]; ?>"}}, |
| 26 |
|
| 27 |
/* Else, this is a safe fallback. */ |
| 28 |
{type: "download", /* Download the file. */ |
| 29 |
config: {file: "<?php echo $mp4["url"]; ?>"}} |
| 30 |
], |
| 31 |
/* Set video dimensions. */ width: 480, height: 270 |
| 32 |
}); |
| 33 |
</script> |
| 34 |
|
| 35 |
<?php } else /* Access is denied to the current User. */ { ?> |
| 36 |
Sorry, you do NOT have access to this file. |
| 37 |
<?php } ?> |