Dynamic bit-rate RTMP streaming via CloudFront with JWPlayer
CloudFront is a service in AWS, which has serves as CDN for downloadable data and stream-able data. Videos stored in Amazon S3 can be streamed using CloudFront which is in rtmp format. Here in this post I am going to make a multi-bitrate selection for videos in JW Player which will have a result as shown in the below picture where we can choose bit-rate of videos to be played:
The code for the player page is as follows:
<html>
<head>
<script src="http://jwpsrv.com/library/H5ZwPmjuEe.js"></script>
</head>
<body>
<div id="mediaplayer">
Loading the player...
</div>
<script type="text/javascript">
jwplayer('mediaplayer').setup({
playlist: [{
sources: [{
file: "videos_playlist.smil"
}]
}],
primary: "flash"
});
</script>
</body>
</html>
<smil>
<head>
<meta base="rtmp://s2as2xpom4wy97.cloudfront.net:1935/cfx/st/"/>
</head>
<body>
<switch>
<video src="sample-720p.mp4" system-bitrate="720000" />
<video src="sample-360p.mp4" system-bitrate="3600000" />
<video src="sample-120p.mp4" system-bitrate="120000" />
</switch>
</body>
</smil>
This system is not only for use with RTMP stream served by CloudFront but you can use with your own RTMP VOD streams.

Comments
Post a Comment