latest stable versions: v140409 (changelog)

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

Cloudfront subfolder streaming error

Home Forums Community Forum Cloudfront subfolder streaming error

This topic contains 3 replies, has 3 voices.
Last updated by  Jason (Lead Developer) 1 year, 3 months ago.

Topic Author Topic
Posted: Thursday Dec 20th, 2012 at 10:21 am #35165

We have Cloudfront integrated with our site and it is working as expected with our videos. When we have the video in the “root” folder of the bucket, it works perfectly (ie: demo_movie.mp4).

We created a sub-folder, since we want to organize the videos a bit and put the exact same movie into that folder. (ie: demo/demo_movie.mp4).

As soon as we change the video location to the sub-folder, when we try to use RTMP only we get an “Error Loading stream: ID Not found on Server”. The MP4 download works perfectly though.

My question is, if we create a subfolder in the bucket (it was done over a week ago), are there any other configuration steps needed to allow that folder to stream as well?

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

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

<?php /* A direct URL to the RTMP source; counting the file against the current User in real-time. */
$cfg = array ("downloadkey"=>false,"file_download" => $s2_jw_config["mp4_video_file_name"], "url_to_storage_source" => true, "count_against_user" => true); ?>

<?php /* API Function `s2member_file_download_url()` returns false if access is denied to the current User. */
if (($mp4 = s2member_file_download_url ($cfg, "get-streamer-array"))) { ?>

    <script type="text/javascript">
        jwplayer("jw-container").setup(
                {
                    width: '800', height: '450',
                    playlist:[
                        {   //image:"/wp-content/uploads/2012/12/4_Single-Arm-Overhead-Extension.png",
                            sources:
                                [
                                  
                                    {type: "rtmp", file: "<?php echo $mp4["streamer"]; ?>/<?php echo $mp4["file"]; ?>"},
                                    {type: "mp4", file: "<?php echo $mp4["url"]; ?>"}
                                ]
        
                        }
                ]});
    </script>

<?php } else /* Access is denied to the current User. */ { ?>
    Sorry, you do NOT have access to this file.
<?php } ?>
</center>
  • This topic was modified 1 year, 4 months ago by  Seth Horowytz.

List Of Topic Replies

Viewing 3 replies - 1 through 3 (of 3 total)
Author Replies
Author Replies
Posted: Thursday Dec 20th, 2012 at 11:22 am #35174

Figured it out!

If you have sub-folders you want to stream from, we had to have the “MP4:” extension pre-prepended to the string.
I guess this tells Cloudfront exactly what file it needs to be from, including folder. Strangely it seems to work if the files are just in the root folder.

...
 {type: "rtmp", file: "<?php echo $mp4["streamer"]; ?>/mp4:<?php echo $mp4["file"]; ?>"},
 ...
 

Note the “mp4:” prepend.
Maybe this should be handled by s2Memeber automatically? Detect the file type based on extension and pre-pend the “mp4:” tag? Would save a lot of headache!

Posted: Friday Dec 21st, 2012 at 8:37 am #35237
Staff Member

Thanks for sharing that, Seth! I’ll forward it to Jason. :)

Posted: Saturday Dec 29th, 2012 at 4:28 pm #35750
Staff Member

Thanks for the heads up on this thread.

I’m having the code samples for JW Player updated in the next maintenance release to include the mp4: prefix for streaming distributions. You’re right, it works fine from the root bucket, but not from a directory, not in the latest version of CloudFront. This seems to be a change in the way the latest versions of the CloudFront API handle streaming requests, indicated by this article.

Viewing 3 replies - 1 through 3 (of 3 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 WordPress.org. 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.