Thanks for your patience.
OK. This expiration time is something s2Member implements in conjunction with Amazon S3. s2Member tells S3 to expire the link after 30 seconds automatically, for improved security. This has been optimized for web browsers and not for byte range requests where you have repeated calls against the S3 URL. In most cases, the download begins and ends after a single request. So 30 seconds is more than enough time for a customer to connect to the file and begin downloading the file. It won’t matter how long it takes them to download the file, as long as they connect within 30 seconds.
Now, in cases where you have devices that are attempting to perform byte-range requests, this can become problematic, obviously. 30 seconds after the initial connection, the underlying resource expires. So future attempts (i.e. additional byte-range requests) would require a new File Download Link.
There are two easy ways to avoid this issue.
1. s2Member exposes a plugin filter that allows you to modify the default expiration time of 30 seconds. So if you’d like to extend this out longer, in support of devices that make byte-range requests, you can certainly do that.
Please create this directory and file:
/wp-content/mu-plugins/s2-hacks.php
<?php
add_filter('ws_plugin__s2member_amazon_s3_file_expires_time', 'my_custom_expiration_time');
function my_custom_expiration_time(){ return '2 hours'; }
?>
(NOTE: these are MUST USE plugins, see: http://codex.wordpress.org/Must_Use_Plugins)
(See also: http://www.s2member.com/kb/hacking-s2member/)
You can specify any length of time you like. Please use a string that is compatible with PHP’s strtotime() function. Ex: 2 hours, 2 weeks, 10 days, are all valid periods of time.
2. OR (HIGHLY RECOMMENDED). When you’re attempting to reach a large audience and support multiple devices, we recommend integration with BOTH Amazon S3 and with CloudFront. This is a non-issue with CloudFront integration. I think you’ll find that s2Member works much more reliably with CloudFront, and your customers are going to get content delivered from edge locations as well, making everything more enjoyable for you and your customers. See: Dashboard -› s2Member® -› Download Options -› Amazon® S3/CloudFront CDN Storage
s2Member’s CloudFront integration is designed specifically to support byte-range requests through the RTMP protocol, which will support true media streams (i.e. you can SEEK through media files). The default expiration time on CloudFront integration is 24 hours. If you want to extend that out farther, there is a filter for that as well.
Please create this directory and file:
/wp-content/mu-plugins/s2-hacks.php
<?php
add_filter('ws_plugin__s2member_amazon_cf_file_expires_time', 'my_custom_expiration_time');
function my_custom_expiration_time(){ return '36 hours'; }
?>
(NOTE: these are MUST USE plugins, see: http://codex.wordpress.org/Must_Use_Plugins)
(See also: http://www.s2member.com/kb/hacking-s2member/)
You can specify any length of time you like. Please use a string that is compatible with PHP’s strtotime() function. Ex: 24 hours, 36 hours, 2 weeks, are all valid periods of time.
Please let us know if problems persist :-)