latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

s2Member & JW Player – Video Stalls

Home Forums Community Forum s2Member & JW Player – Video Stalls

Tagged: , ,

This topic contains 23 replies, has 6 voices. Last updated by  Cristián Lávaque 4 years, 5 months ago.

Topic Author Topic
Posted: Tuesday Jul 3rd, 2012 at 4:40 pm #18222
Mary May
Username: marymay

Video files under the protection of s2Memeber (in the s2member-files directory) are being served through JW Player on a WordPress blog. Some of these videos play for a while and then stall. It is not like the usual stop-n-go rebuffering we often see with videos. These just stall, the spinner spins forever, and they can’t be restarted.

The videos are H.264, mp4, 640×480, bit rates from 980-1500kbps, Baseline@Level 3.0, no CABAC, no b-frames, no p-frames and with 60kbps audio AAC Low Complexity.

When the videos are in a directory NOT protected by s2Member, they play well. No stalls, not even rebuffering pauses.

Watch the progress bar in two examples.
In the no-login example one can see the progress bar indicating buffered content that advances a good distance ahead of the current position.
In the logged-in example, the amount of content buffered is very small, almost an imperceptible amount ahead of the current position. This goes on until the current position overcomes the miniscule buffered amount.

What is it about s2Member that constrains the file delivery in this way?

Test cases:
login required – http://www.marymaycarving.com/carvingschool/2012/06/28/beginning-carving-how-to-carve-a-donut/
login not required – http://www.marymaycarving.com/carvingschool/2012/06/02/long-video-test/

Credentials to use: ID=s2tester pw=free-preview

List Of Topic Replies

Viewing 23 replies - 1 through 23 (of 23 total)
Author Replies
Author Replies
Posted: Wednesday Jul 4th, 2012 at 11:37 pm #18329

Hi Mary.

Do you have the protected files in your s2member-files dir or did you integrate with Amazon to host the files and serve them from there?

The thing with protected files is that, in order to protect them, they’ll be served through the script instead of directly and, depending on the server’s configuration, this can give timeout problems if the file is large. http://www.primothemes.com/forums/viewtopic.php?f=36&t=423

For streaming or large files, it’s much better to use the Amazon service. Video » s2Member® File Downloads (Amazon S3/CloudFront/JW Player)

I hope that helps. :)

Posted: Thursday Jul 5th, 2012 at 6:18 am #18367
Mary May
Username: marymay

Yes Cristián, the files are in the s2member-files directory as mentioned in the very first sentence.

We have a dedicated server with more than enough storage and more than enough bandwidth, and NO desire to introduce the added cost of Amazon S3.

What can we change on a dedicated server to improve the situation?

Posted: Friday Jul 6th, 2012 at 6:55 am #18453

I understand.

There’s this knowledbase article to help with download problems. Could you try the suggestions made there? Knowledge Base » Resolving Problems with File Downloads

And you can try this server check tool to see if everything looks fine there. http://www.s2member.com/r/server-check-tool/

Let me know if that helps. :)

Posted: Saturday Jul 7th, 2012 at 3:13 pm #18571
Mary May
Username: marymay

Knowledge base article was interesting, but did not help with this case.

Passed all tests with the server test tool.

Serving the files through a script is almost as inefficient as having a man stand at a service window and hand out video frames one-by-one.

We have resolved the problem.

Posted: Sunday Jul 8th, 2012 at 6:54 am #18603

I’m glad you solved it! Thanks for the update. :)

Yes, it’s not ideal, but it’s very secure to validate the user before serving it, and not making it possible for someone to share the URL to the actual file later. We’re looking at how to improve it in the new s2Member.

Posted: Sunday Jul 8th, 2012 at 5:11 pm #18624
Hamid
Username: zawiyaprojects

Hello Mary May, curious to know the resolution. Can you share?

Posted: Monday Jul 9th, 2012 at 7:39 am #18662
Mary May
Username: marymay

Hamid,
(Bob Easton answering for Mary. I’m doing the technical work for her site.)

After learning of this script-based method, we investigated a number of other membership plugins which advertise strong file protection. When asking them technical questions about how they secure files, two basic methods emerged.

For locally stored files (local=same server as the web site) many use the script method, which must have been quite popular a few years ago, the same method that s2Member uses for local files.

The other method uses various forms of authentication tokens (often time limited) and URL obfuscation to authorize content delivery from remote sources such as Content Distribution Networks. s2Member is capable of using this approach with Amazon S3.

So, instead of having our own server resources clogged up with continuously running scripts, we coughed up yet more money and moved the content to Amazon S3.

Posted: Monday Jul 9th, 2012 at 7:53 am #18663
Hamid
Username: zawiyaprojects

Hello Bob, your response came in just in time…

I had been debating whether to serve files off of Amazon S3 and CloudFront. I decided to go with Amazon and I just finished setting up my new bucket and configuring s2member. Let hope the cost isn’t that much :)

Thanks for sharing… you made me feel good about our decision to go with s2member (even though I’m a newbie to s2member, I’m really starting to love it).

Posted: Monday Jul 9th, 2012 at 10:52 pm #18750
Staff Member

Thanks for the heads up on this request for support.

What is it about s2Member that constrains the file delivery in this way?

Yes Cristián, the files are in the s2member-files directory as mentioned in the very first sentence.

We have a dedicated server with more than enough storage and more than enough bandwidth, and NO desire to introduce the added cost of Amazon S3.

What can we change on a dedicated server to improve the situation?

If you’re having trouble with large file downloads and/or streaming audio/video, I recommend a media server like Amazon S3 w/ CloudFront, so that files are delivered directly from the media server, as opposed to being protected and served locally via PHP scripts (i.e with s2Member local file storage).

The hang ups that you’re seeing, are related specifically to PHP-based file downloads, via scripts. Depending on server configuration and the hosting environment, scripts timeout limits, memory limits, etc… you may have different results and unreliable file delivery (with very large files). PHP is not a good way to serve large files, it’s prone to the issues you’ve described; and this is why Amazon S3/CloudFront have been integrated with s2Member.

To clarify… It’s not a server capacity issue, it’s related to the way files are served locally via PHP scripts, which almost always have execution time & resource limits associated with them. When s2Member is integrated with Amazon S3, authentication is still performed via PHP, but the actual file delivery occurs through a signed link, which leads directly to the media server. So it’s a much better approach, bypassing issues that are commonly seen with very large files (i.e. streaming audio/video).

You can try increasing the max_execution_time directive in your PHP.ini file, and increasing your memory_limit to see if it helps, but I consider those to be temporary workarounds, and not a permanent resolution for this issue. In my opinion, the best solution for large files, is to integrate s2Member with Amazon S3, so that files are protected by Amazon S3, and permissions integrated with s2Member. Adding CloudFront to the mix is optional, but I recommend that as well; particularly for faster delivery of streaming audio/video.

Posted: Tuesday Jul 10th, 2012 at 8:46 am #18803
Hamid
Username: zawiyaprojects

I cannot seem to get jwplayer to work (even after following the instructions) using s3 and CloudFront.

I CAN download the same file via a different test page using the shortcode:

<a href="[s2File download="20120504_Review_10.54-58.mp4" download_key="true" /]">Download</a>

I just can’t get jwplayer to stream the file. The test page Im using for jwplayer comes up with the following text:

JW Player® appears here.

Raw html plugin is installed and all four checkboxes for Disable wptexturize, Disable automatic paragraphs, Disable convert_chars, Disable smilies are checked.

Here is the code for the test page:

<?php
// Configuration.
$s2_jw_config["jwplayer"] = "/jwplayer/"; // Relative URL path to JW Player files directory.
$s2_jw_config["mp4_video_file_name"] = "20120504_Review_10.54-58.mp4"; // Name of your MP4 test file.
// Don't edit anything else below unless you know what you're doing.
?>

<div id="jw-container">JW Player® appears here.</div>
<script type="text/javascript" src="<?php echo $s2_jw_config["jwplayer"]; ?>jwplayer.js"></script>

<script type="text/javascript">
    /* The Shortcode here will return a JSON object for JavaScript notation. */
    /* A direct URL to the RTMP source; counting the file against the current User in real-time. */
    /* API Shortcode `s2File` returns a null object if access is denied to the current User/Member. */
    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" /];
</script>

<script type="text/javascript">
    if(typeof mp4 === 'object') /* `s2File` returns a null object if access is denied to the current User. */
        {
            jwplayer("jw-container").setup({modes: /* JW Player®. */
            [
                /* First try real-time streaming with Flash® player. */
                {type: "flash", provider: "rtmp", src: "<?php echo $s2_jw_config["jwplayer"]; ?>player.swf",
                    config: {streamer: mp4['streamer'], file: mp4['file']}},
            
                /* Else, try an HTML5 video tag. */
                {type: "html5", provider: "video",
                    config: {file: mp4['url']}},
            
                /* Else, this is a safe fallback. */
                {type: "download", /* Download the file. */
                    config: {file: mp4['url']}}
            ],
            /* Set video dimensions. */ width: 480, height: 270
            });
        }
    else /* Else, `s2File` returned a null object value. */
        {
            document.write('Sorry, you do NOT have access to this file.');
        }
</script>

JWplayer is installed in root directory and I can access the player.swf directly.

Not sure why it’s not working. Any ideas? What am I missing or doing wrong. Really need some help her guys :(

Posted: Tuesday Jul 10th, 2012 at 11:21 am #18812

@ Hamid

You just have the incorrect location for your file.

That script is looking for the file located relative to wp-content/plugins/s2member-files/ or your s3 bucket.

Posted: Tuesday Jul 10th, 2012 at 1:33 pm #18823
Hamid
Username: zawiyaprojects

Thanks Philly,

But the file is in the root directory of my s3 bucket…. that’s why I cant figure this out.

Posted: Tuesday Jul 10th, 2012 at 4:19 pm #18829

@ Hamid

Yes sorry of course you do if your able to download it.

Can you disable plugins see if there is a conflict?

Posted: Tuesday Jul 10th, 2012 at 5:21 pm #18835

Hamid, could you check out this article and see if it helps with this? Knowledge Base » JW Player sample code not working

Posted: Wednesday Jul 11th, 2012 at 9:11 am #18916
Mary May
Username: marymay

Hamid,
(Bob Easton, Mary Mays “code monkey”)

When all you see is text “JW Player® appears here” instead of the player itself, that means the player .swf file was not found. Fix that first. Then, go for the content.

I like to make small simple steps. So, simplify your script using real URLs instead of variables. Get each of the pieces properly located. Then, figure out which variables to use / change.

Posted: Saturday Jul 14th, 2012 at 12:44 am #19203
Hamid
Username: zawiyaprojects

Hello Bob, thanks for the suggestion.

I’ve been trying to resolve s3 and cloudfront since I’ve installed s2member. I’m going nuts…

I ended up reinstalling WordPress and s2member with very few plugins activated. Here are my results:

If I only use s3 (without cloudfront), I am able to download my files using example shortcode and links such as:

<a href="[s2File download="20120504_Review_10.54-58.mp4" /]">Download Now</a>

<a href="[s2File download="20120504_Review_10.54-58.mp4" inline="false" /]">Download Now - Not Inline</a>

<a href="<?php echo s2member_file_download_url(array("file_download" => "20120504_Review_10.54-58.mp4", file_download_key => true)); ?>">Download Now with Key</a>

<a href="[s2File download="20120504_Review_10.54-58.mp4" download_key="true" /]">Download</a>

The moment I add cloudfront, the above links all fail with the following error (even after creating new keys):

AccessDeniedAccess denied

Anyone have any ideas why?

P.S. JWPlayer still doesn’t work for me but will get to that later after resolving my Cloudfront issue.

Posted: Saturday Jul 14th, 2012 at 6:45 am #19239
Raam Dev
Username: Raam
Staff Member

Hi Hamid,

Did you allow s2Member to auto-configure your CloudFront Distributions? Also, have you double-checked your CloudFront configuration in Dashboard -› s2Member® -› Download Options -› Amazon® S3/CloudFront CDN Storage?

Posted: Saturday Jul 14th, 2012 at 8:27 am #19245
Hamid
Username: zawiyaprojects

Hey Raam,

Yes I allowed s2member to auto configure the distributions and it said it was set up correctly.

The distros were created and I could see them via my AWS console. I have deleted and recreated the download and streaming distros a few time now, all with the same results :(

I have deleted them again for now as I’m not sure what the problem could be, although I am able to download via my s3 bucket (as long as cloudfront isnt configured).

Has anyone else seen this before?

Posted: Saturday Jul 14th, 2012 at 10:47 am #19255
Hamid
Username: zawiyaprojects

Issue Resolved with Cloudfront :)

I’m not quite sure which of the two resolved it but…

1.) I deleted all my Amazon key pairs and recreated new keys.
2.) I noticed that when I copied and pasted the key pairs into the s2member fields that some fields would have a space at the end of the string. I made sure to remove the spaces.

Now back to JWPlayer… still shows “JW Player® appears here.”

I can access the player.swf if I point my browser to http://www.domain.com/jwplayer/ so Im not sure why it cant find it thru s2member/wordpress.

Posted: Saturday Jul 14th, 2012 at 12:05 pm #19258

@ Hamid

Glad you resolved that part.

I think its because you have not setup your download restrictions.

Dashboard => s2Member® => s2Member® File Download Options => Basic Download Restrictions

Let us know how that goes and if you need any help configuring a shortcode

Posted: Sunday Jul 15th, 2012 at 3:38 am #19282
Hamid
Username: zawiyaprojects

OK, I admit it. I’m an idiot!!!

I finally got it to work, hurray :)

Here is what I did.

1.) I entered 999999 in ALL the fields for “Basic Download Restrictions” even though I’m only using member level 0 and 1 (at the moment)
2.) Although it still works with the comments included, I striped all the comment from the “JW Player® & RTMP Protocol Examples” code in order to simplify things just in case I was overlooking something, which I was.
3.) I didn’t see that there are TWO [script type=”text/javascript”] sections. I had only placed the “raw” tag around the first one.
4.) I humble myself before you guys. Soooooo sorry for being such a dolt and thanks for all your help, comments and patience in getting me thru this :)

I have supplied my modified example code for other to see. Please note, that you may not be able to edit your page after publishing it the first time due to the (raw) tags. When I edited the page after publishing it, it would break again, I believe because of the (raw) tags redoing its thing on the already modified code.

Please Note: I used parenthesis () instead of brackets [] around the raw tag due to the posting restriction of this forum. If you use the code below, make sure to change the raw tags to include brackets (and not parenthesis as displayed below).

<?php
$s2_jw_config["jwplayer"] = "/jwplayer/";
$s2_jw_config["mp4_video_file_name"] = "reviews/20120427_Review_10.50-55.mp4";
?>

<div id="jw-container">JW Player® appears here.</div>
(raw)<script type="text/javascript" src="<?php echo $s2_jw_config["jwplayer"]; ?>jwplayer.js"></script>(/raw)

<?php
$cfg = array ("file_download" => $s2_jw_config["mp4_video_file_name"], "url_to_storage_source" => true, "count_against_user" => true); 
?>

<?php
if (($mp4 = s2member_file_download_url ($cfg, "get-streamer-array"))) { 
?>

    (raw)
    <script type="text/javascript">
        jwplayer("jw-container").setup({modes: /* JW Player®. */
        [
            {type: "flash", provider: "rtmp", src: "<?php echo $s2_jw_config["jwplayer"]; ?>player.swf",
                config: {streamer: "<?php echo $mp4["streamer"]; ?>", file: "<?php echo $mp4["file"]; ?>"}},
        
            {type: "html5", provider: "video",
                config: {file: "<?php echo $mp4["url"]; ?>"}},
        
            {type: "download",
                config: {file: "<?php echo $mp4["url"]; ?>"}}
        ],
        width: 640, height: 395
        });
    </script>
    (/raw)

<?php } else { ?>
    Sorry, you do NOT have access to this file.
<?php } ?> 

Thanks everyone… now on to the next mountain mole hill :)

Posted: Sunday Jul 15th, 2012 at 3:55 am #19283
Hamid
Username: zawiyaprojects

Oh I forgot to add this. I’m not sure if this was an issue but in any case…

5.) The crossdomain.xml in my bucket was empty so I re-uploaded it with the following data:

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
  <allow-access-from domain="*" />
</cross-domain-policy>
Posted: Monday Jul 16th, 2012 at 7:32 am #19344

Thanks for the update, Hamid. Very glad you solved it! :)

Viewing 23 replies - 1 through 23 (of 23 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.