JW FLV Player – Red5 streaming issue – (unable to replay)



As of the current version of JW FLV Media Player 4.6, there is a issue with streaming flv videos from red5 server (tested with 0.7). As there is no solution given on the forum i decided to explore it on my own. The problem happens when flash requests a stream from red5. At this stage red5 generates a meta file which is used to trigger meta event on flv players. However at this stage the flv itself is considered as broken. Hence any attempt to play back the video now will fail until the meta is removed and flv restores to normal by red core engine. It seems the most obvious manual way to do this manually was to hit the stop button and help red5 understand the stream request was released. so using the jwflv player javascript API, i could form this solution to inform red5. (god’s grace :) )

You just have to setup a event handler to get notification from the player that the stream has requested release (stop), when the stream completes and the Model State changes to “COMPLETE”.

Here is the full code snippet:


Consider this is your player embed code via swfobject.

var flashvars = {};
flashvars.image = "http://flashvisions.com/wp-content/uploads/2009/10/flv-preview.jpg";
flashvars.type = "rtmp";
flashvars.streamer = "rtmp://localhost/oflaDemo";
flashvars.file = "on2_flash8_w_audio.flv";
var params = {};
params.quality = "autohigh";
params.allowfullscreen = "true";
var attributes = {};
attributes.id = "jwrtmpflvplayer";
attributes.name = "jwrtmpflvplayer";
swfobject.embedSWF("http://flashvisions.com/wp-content/uploads/2009/10/player.swf", "jwflvplayer_rtmp", "320", "240", "9.0.0", "http://flashvisions.com/wp-content/plugins/kimili-flash-embed/lib/expressInstall.swf", flashvars, params, attributes);

Just setup a STATE Change event handler on the player by its object id, on “playerReady” callback.

var player;
function playerReady(obj) {
player = document.getElementById('jwrtmpflvplayer');
player.addModelListener("STATE","stateTracker");
};
function stateTracker(obj)
{
if(obj.newstate == 'COMPLETED') player.sendEvent("STOP");
};

Now your player should run perfectly even on second time playback request on red5.

Example: http://flashvisions.com/general/http-vs-rtmp-streaming-a-visual-example/

Popularity: 14% [?]




October 24, 2009   Posted in: Commercial, Red5, RTMP

16 Responses

  1. Flithost - July 26, 2010

    Yeah it works awesome

  2. Sandpaper - March 9, 2011

    Double strollers…

    [...]the time to read or visit the content or sites we have linked to below the[...]…

  3. Randy's blog - March 9, 2011

    Steve’s Super Site…

    [...] You may leave a reply, or trackback from your own personal website. Read more via the original source: How to Get Ripped: « Ripped Abs weblog Share and [...]…

  4. troubleshooting car problems - March 10, 2011

    new and upcoming…

    [...]below you’ll find the link to some sites that we think you should visit[...]…

  5. Chicken Coop Design - March 10, 2011

    Araucana Chicken…

    [...]Sites of interest we like to link to[...]…

  6. Mint - March 10, 2011

    Cheers, enjoyed the read…

    [...]I link out rarely, but this was praiseworthy. Bravo, hope we can work together in the future[...]…

  7. Scary Maze - March 11, 2011

    Play Scary Maze…

    [...]here are some other site that might interest you[...]…

  8. diesel generators for sale - March 15, 2011

    ETQ DG6LE Diesel Generator…

    [...]by our link generator, to point you to…

  9. margarita machine - March 16, 2011

    margarita machine or a blender…

    [...]the time to read or visit the content or sites we have linked to below the[...]…

  10. detox cleanse - March 19, 2011

    wonga.com…

    [...]we came across a cool site that you might enjoy. Take a look if you want[...]…

  11. Classic Car Transport - March 19, 2011

    Auto Transport…

    [...]all of us found your web blog had been described upon the garment printer website[...]…

  12. blue buffalo - March 22, 2011

    blue buffalo…

    [...] the time to read or visit the content or sites we have linked to below the [...]…

  13. Roll Off Trucks For Sale - March 23, 2011

    New Trash Truck…

    [...]i noticed your website seemed to be stated about our own tv screen making world wide web[...]…

  14. Dump Trucks For Sale - March 23, 2011

    Mack Truck…

    [...]all of us found your web blog was mentioned on our website[...]…

  15. fios eletricos - March 29, 2011

    Parking in Brooklyn…

    [...]below you’ll find the link to some sites that we think you should visit[...]…

  16. Approved - April 1, 2011

    [...]are our favorite sites of our friends[...]…

Leave a Reply