Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Streaming Video - jwplayer, amazon s3 and cloudfront

I have a streaming distribution at s6b99lczhnef6.cloudfront.net on Amazon. The origin is a bucket in S3. The bucket has a video video.mp4. It's public. I am trying to test streaming this video with jwplayer, following is the code:

<html>
<head>
    <script type="text/javascript" src="jwplayer/jwplayer.js"></script>
</head>
<body>
    <div id="container">Loading the player ...</div>
    <script type="text/javascript">
    jwplayer("container").setup({
        flashplayer: "jwplayer/player.swf",
        file: "video.mp4",
        height: 270,
        provider: "rtmp",
        streamer: "rtmp://s6b99lczhnef6.cloudfront.net/cfx/st",
        width: 480
    });
    </script>
</body> 
</html>

The video is not playing. There are no JS errors. What could be going wrong?

like image 639
septerr Avatar asked Jun 10 '12 18:06

septerr


2 Answers

The amazon documentation is valid for JW Player 5.9, and JW Player's documentation is fairly sparse on using CloudFront streaming. As briefly explained here, specifying the streaming source has changed with JW Player 6. This is the new way to specify a streaming source:

<div id='mediaplayer'>This text will be replaced</div>
<script type="text/javascript">
   jwplayer('mediaplayer').setup({
      'id': 'playerID',
      'width': '720',
      'height': '480',
      'file': 'rtmp://s1cxpk7od1m10r.cloudfront.net/cfx/st/your_streaming_file.mp4',
      'primary':'flash',
      'autostart' : 'true',
   });
</script>

If your stream is in the folder, you might have some issues using the file reference above. I'm not sure why rtmp://s1cxpk7od1m10r.cloudfront.net/cfx/st/folder/your_streaming_file.mp4 wouldn't work for me (I think it has something to do with URL encoding), however using this for the file param when accessing a streaming resource located in a folder worked for me:

rtmp://s1cxpk7od1m10r.cloudfront.net/cfx/st/mp4:folder/your_streaming_file.mp4

If you want to test your connection string and get some debugging output, checkout this streaming diagnostic tool.

You do not need to specify a bucketname anywhere in the embed code.

like image 200
iloveitaly Avatar answered Dec 16 '22 20:12

iloveitaly


I think you have to give file string value as bucketname/video.mp4 else all seems fine.

like image 29
Tej Kiran Avatar answered Dec 16 '22 20:12

Tej Kiran