You are currently browsing the monthly archive for February 2012.

There’s two playback player which we were considering, Flowplayer and JWplayer. From googling, both are seem equal on functionality at the moment. However from pricing, Flowplayer offer one-time fee for one domain USD 95, while JWplayer offer license USD 89 for one domain and plugin charged separately, which could make it more expensive. The project owner prefer JWplayer since he saw many competitors are using it. And here I’am trying JWplayer first.

The main requirement for the playback player are the following:

  1. support for RTMP live streaming
  2. autoplay, once the html page is open, the playback plays automatically without users click play button
  3. if the broadcast from encoder is stopped, then started again (after several minutes), the player is expected to automatically play the stream again without user refresh the page or click the play button again

The documentation is easy to follow, and i quickly find how to accomplish point 2 above. There are three ways to embed JW Player into HTML:

  • Using the JW Player’s own JavaScript Embedder (jwplayer.js), Recommended
  • Using a generic JavaScript embedder (like SWFObject)
  • Using a HTML tag (like <object> or )

I choose the recommended point, include jwplayer.js in my script.

In order to accomplish point 3, at first I found useful plugin for this, livestream-1. When the live streaming is stopped, the plugin will check the stream within time interval (configurable) and automatically play it when available. However once I tried it, the plugin kept looking the stream even the stream was already playing :( The JWplayer Forum also said there’s a bug as well for this plugin.

I replaced that plugin with simple javascript code, with help of Javascript API Reference .
The simple script below works as expected:

<div id='container'>The player will be placed here</div>

<script type="text/javascript">
jwplayer("container").setup({
flashplayer: "jwplayer/player.swf",
file: "myStream",
autostart: "true",
height: 270,
width: 480,
provider: "rtmp",
streamer: "rtmp://www.yoursite.com/live"
});

<!--
//Script to handle time out; used in case live streaming stopped
//by ip5up 2012-01-26
var t;
var timer=5000;
jwplayer().onIdle(function() {
t=setTimeout("jwplayer().play()",timer);
});

</script>

PS: Don’t forget to include script jwplayer.js in the head section

 

February 2012
M T W T F S S
« Jan   Mar »
 12345
6789101112
13141516171819
20212223242526
272829  
Follow

Get every new post delivered to your Inbox.