PluginProbe
s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions / 260805
s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions v260805
260917 260913 260909 260829 260814 260805 110710 110731 110812 110815 110912 110913 110915 110926 110927 111002 111003 111011 111017 111029 111105 111206 111216 111220 120213 All 189 releases
s2member / src / includes / menu-pages / code-samples / jwplayer-streaming-mp4-sca.x-php

jwplayer-streaming-mp4-sca.x-php in s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions 260805, at src/includes/menu-pages/code-samples/jwplayer-streaming-mp4-sca.x-php

40 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 <script>
13 // The Shortcode here will return a JSON object for JavaScript notation.
14 // A direct URL to the RTMP source; counting the file against the current User in real-time.
15 // API Shortcode `s2File` returns a null object if access is denied to the current User/Member.
16 var mp4 = [s2File download="<?php echo $s2_jw_config["mp4_video_file_name"]; ?>" url_to_storage_source="true" count_against_user="true" get_streamer_json="true" /];
17 </script>
18
19 <script>
20 if(typeof mp4 === 'object') // `s2File` returns a null object if access is denied to the current User.
21 {
22 jwplayer('jw-container').setup({
23 playlist:
24 [{
25 sources: // List all available sources.
26 [
27 {type: 'rtmp', file: mp4['streamer'] + '/mp4:' + mp4['file']},
28 {type: 'mp4', file: mp4['url']}
29 ]
30 }],
31 primary: 'flash' /* Try Flash® RTMP first, fallback on HTML5 or direct download of MP4 file. */,
32 width: 480, height: 270 // Set video dimensions for all sources.
33 });
34 }
35 else // Else, `s2File` returned a null object value.
36 {
37 document.write('Sorry, you do NOT have access to this file.');
38 }
39 </script>
40