NOTE: this has been revised to make it more flexible, and allow multiple streamers and multiple video types, using the same code.
This is a script that allows you to add as many JW FLV players to a page as you want, using a single block of code. The players all have separate event listeners to keep them from interfering with each other. Events or actions executed in one player do not affect others.
This particular demo also corrects for a problem we have noticed recently with Red5, where RTMP streams will hang with a “BUFFER.EMPTY” status code. I’ve set up meta-monitoring so that it catches “BUFFER.EMPTY” codes and starts the player up again a little bit previous to the break. It creates player names and function names dynamically, based on how many players you request. If this function seems to be giving you problems, if your videos start jumping back and restarting a lot, search for the following line and comment it out by adding “//” in front of it:
window["player_"+obj.id].sendEvent('SEEK', parseInt(window["positionarray_"+obj.id][3])+100);
We’ve also had problems with some videos that simply refuse to stream, although they will play using progressive download. You can use a mixture of streaming and non-streaming by altering the playlist for each video.
Continue reading