| 1 |
<?php |
| 2 |
// Configuration. |
| 3 |
$s2_jw_config["jwplayer"] = "/jwplayer/"; // Relative URL path to JW Player files directory. |
| 4 |
$s2_jw_config["mp4_video_file_name"] = "video.mp4"; // Name of your MP4 test file. |
| 5 |
// Don't edit anything else below unless you know what you're doing. |
| 6 |
?> |
| 7 |
|
| 8 |
<div id="jw-container">JW Player® appears here.</div> |
| 9 |
<script src="<?php echo $s2_jw_config["jwplayer"]; ?>jwplayer.js"></script> |
| 10 |
<script>jwplayer.key = 'YOUR KEY HERE';</script> |
| 11 |
|
| 12 |
<?php // A direct URL to the RTMP source; counting the file against the current User in real-time. |
| 13 |
$cfg = array("file_download" => $s2_jw_config["mp4_video_file_name"], "url_to_storage_source" => true, "count_against_user" => true); ?> |
| 14 |
|
| 15 |
<?php // API Function `s2member_file_download_url()` returns false if access is denied to the current User. |
| 16 |
if (($mp4 = s2member_file_download_url ($cfg, "get-streamer-array"))) { ?> |
| 17 |
|
| 18 |
<script> |
| 19 |
jwplayer('jw-container').setup({ |
| 20 |
playlist: |
| 21 |
[{ |
| 22 |
sources: // List all available sources. |
| 23 |
[ |
| 24 |
{type: 'rtmp', file: '<?php echo $mp4["streamer"]; ?>/mp4:<?php echo $mp4["file"]; ?>'}, |
| 25 |
{type: 'mp4', file: '<?php echo $mp4["url"]; ?>'} |
| 26 |
] |
| 27 |
}], |
| 28 |
primary: 'flash' /* Try Flash® RTMP first, fallback on HTML5 or direct download of MP4 file. */, |
| 29 |
width: 480, height: 270 // Set video dimensions for all sources. |
| 30 |
}); |
| 31 |
</script> |
| 32 |
|
| 33 |
<?php } else /* Access is denied to the current User. */ { ?> |
| 34 |
Sorry, you do NOT have access to this file. |
| 35 |
<?php } ?> |
| 36 |
|