| 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 |
$cfg = array ("file_download" => "video.mp4", "url_to_storage_source" => true, "count_against_user" => true); ?> |
| 6 |
|
| 7 |
<?php /* API Function `s2member_file_download_url()` returns false if access is denied to the current User. */ |
| 8 |
if (($mp4 = s2member_file_download_url ($cfg, "get-streamer-array"))) { ?> |
| 9 |
|
| 10 |
<script type="text/javascript"> |
| 11 |
jwplayer("jw-container").setup({modes: /* JW Player®. */ |
| 12 |
[ |
| 13 |
/* First try real-time streaming with Flash® player. */ |
| 14 |
{type: "flash", provider: "rtmp", src: "/jwplayer/player.swf", |
| 15 |
config: {streamer: "<?php echo $mp4["streamer"]; ?>", file: "<?php echo $mp4["file"]; ?>"}}, |
| 16 |
|
| 17 |
/* Else, try an HTML5 video tag. */ |
| 18 |
{type: "html5", provider: "video", |
| 19 |
config: {file: "<?php echo $mp4["url"]; ?>"}}, |
| 20 |
|
| 21 |
/* Else, this is a safe fallback. */ |
| 22 |
{type: "download", /* Download the file. */ |
| 23 |
config: {file: "<?php echo $mp4["url"]; ?>"}} |
| 24 |
], |
| 25 |
/* Set video dimensions. */ width: 480, height: 270 |
| 26 |
}); |
| 27 |
</script> |
| 28 |
|
| 29 |
<?php } else /* Access is denied to the current User. */ { ?> |
| 30 |
Sorry, you do NOT have access to this file. |
| 31 |
<?php } ?> |