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.
flashvars.image = "https://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("https://flashvisions.com/wp-content/uploads/2009/10/player.swf", "jwflvplayer_rtmp", "320", "240", "9.0.0", "https://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.
function playerReady(obj) {
player = document.getElementById('jwrtmpflvplayer');
player.addModelListener("STATE","stateTracker");
};
{
if(obj.newstate == 'COMPLETED') player.sendEvent("STOP");
};
Now your player should run perfectly even on second time playback request on red5.
Example: https://flashvisions.com/general/http-vs-rtmp-streaming-a-visual-example/