Re: Video + File Download Restriction
Posted: September 21st, 2011, 4:14 am
Hi
can you please post the code you are using!
Sam
can you please post the code you are using!
Sam
— WordPress® ( Users Helping Users ) —
http://www.primothemes.com/forums/
<p><script type="text/javascript">jwplayer("jwplayer-1").setup({flashplayer: "http://tamu.louderlearn.com/wp-content/uploads/jw-player-plugin-for-wordpress/player/player.swf", width: "640", height: "400", controlbar: "bottom", "config": "”Tutor", playlist: Player”, "file": "”http://tamu.louderlearn.com/?s2member_file_download=Math141-Session3-091311.mp4”", "wmode": "opaque", events: {}, config: "http://tamu.louderlearn.com/wp-content/uploads/jw-player-plugin-for-wordpress/configs/Tutor Player.xml"});</script></p>
[WS-T-Video src="http://example.com/wp-content/plugins/s2member-files/s2member-file-inline/video.mp4" width="100%" height="400" autostart="false" /]
<div id="jw-container">JW Player® appears here.</div>
<script type="text/javascript" src="/jwplayer/jwplayer.js"></script>
<script type="text/javascript">
jwplayer("jw-container").setup({modes: /* JW Player®. */
[
/* First try psuedo-streaming with Flash® player. */
{type: "flash", provider: "http", src: "/jwplayer/player.swf",
config: {file: "/wp-content/plugins/s2member-files/s2member-file-inline/video.mp4"}},
/* Shortcode equivalent: [s2File rewrite="yes" inline="yes" download="video.mp4" /] */
/* Else, try an HTML5 video tag. */
{type: "html5", provider: "video",
config: {file: "/wp-content/plugins/s2member-files/s2member-file-inline/video.mp4"}},
/* Shortcode equivalent: [s2File rewrite="yes" inline="yes" download="video.mp4" /] */
/* Else, this is a safe fallback. */
{type: "download", /* Download the file. */
config: {file: "/wp-content/plugins/s2member-files/s2member-file-inline/video.mp4"}}
/* Shortcode equivalent: [s2File rewrite="yes" inline="yes" download="video.mp4" /] */
],
/* Set video dimensions. */ width: 480, height: 270
});
</script>
... /wp-content/plugins/s2member-files/s2member-file-inline-yes/s2member-file-download-key-xS54df5ER4d5x/example-file.zip
<?php echo s2member_file_download_key("example-file.zip"); ?>
[jwplayer file="http://www.rasika.org/wp-content/plugins/s2member-files/s2member-file-inline-yes/test.mp3"]
[jwplayer file="http://www.rasika.org/wp-content/plugins/s2member-files/s2member-file-inline-yes/s2member-file-download-key-[s2Key file_download='test.mp3' /]/test.mp3"]
Jason Caldwell wrote:With FlowPlayer, all videos require a FlashVar configuration, and with s2Member it's the same.
function play_audio( $atts ) {
extract( shortcode_atts( array('audiofile' => '', 'player' => 'AudioPlayer'), $atts ) );
if ($audiofile != "") {
$rkey = s2member_file_download_key($audiofile);
$rfile = "http://www.mydomain.org/wp-content/plugins/s2member-files/s2member-file-inline-yes/s2member-file-download-key-".$rkey."/".$audiofile;
return jwplayer_tag_callback('[jwplayer config='.$player.' file='.$rfile.']');
}
else
return '';
}
add_shortcode('raudio', 'play_audio');
[raudio audiofile="test.mp3"]
Correct, this will not work because WordPress can't parse a Shortcode that's embedded into another Shortcode. If you need to generate a File Download Key with s2Member, and place that File Download Key into yet another Shortcode, you will be forced to use the PHP version of s2Member's Download Key generator. So for instance, you might have this...MediocreFred wrote:Continuing the previous post, here is an example...
This works:
- Code: Select all
[jwplayer file="http://www.rasika.org/wp-content/plugins/s2member-files/s2member-file-inline-yes/test.mp3"]
This does not:
- Code: Select all
[jwplayer file="http://www.rasika.org/wp-content/plugins/s2member-files/s2member-file-inline-yes/s2member-file-download-key-[s2Key file_download='test.mp3' /]/test.mp3"]
How do I generate the key inline?
Thanks.
[jwplayer file="http://www.rasika.org/wp-content/plugins/s2member-files/s2member-file-inline-yes/s2member-file-download-key-<?php echo s2member_file_download_key("test.mp3"); ?>/test.mp3"]
MediocreFred wrote:Just in case anybody else is looking to include the Download Key in the URL, here's what I did:
Added this to my custom functions.php file:
- Code: Select all
function play_audio( $atts ) {
extract( shortcode_atts( array('audiofile' => '', 'player' => 'AudioPlayer'), $atts ) );
if ($audiofile != "") {
$rkey = s2member_file_download_key($audiofile);
$rfile = "http://www.mydomain.org/wp-content/plugins/s2member-files/s2member-file-inline-yes/s2member-file-download-key-".$rkey."/".$audiofile;
return jwplayer_tag_callback('[jwplayer config='.$player.' file='.$rfile.']');
}
else
return '';
}
add_shortcode('raudio', 'play_audio');
Within any post or page, I use the shortcode to embed JW Player:
- Code: Select all
[raudio audiofile="test.mp3"]
If there's a better/simpler way of doing this, please let me know. If not, hope this helps somebody down the road.
Thanks.