JavaScript
Article

Debugging and Catching Errors with Flowplayer

By Sam Deering

This is how you can debug setup in flowplayer and catching player/stream errors. It is essential when coding JavaScript with Flowplayer that you turn on the debug in the player so you can see what events are being fired off (they are output in the Firebug console). You can then differentiate player configuration errors to stream errors.

video-unavailable

Related Posts:

Turn on Debug

To turn on debug simply add this to the player config.

debug: true

flowplayer-events

Typical Errors

200 Stream not found, NetStream.Play.StreamNotFound, clip: '[Clip]
201, Unable to load stream or clip file, connection failed> netConnectionURL is not defined, clip: '[Clip] 'null''

So here is a list of Flowplayer events, we can now see what events we can use to optimise the player.

$f.fireEvent ["onBeforeLoad"]
flowpl....min.js (line 24)
$f.fireEvent ["onLoad", "influxis", null, null, null, null]
flowpl....min.js (line 24)
$f.fireEvent ["onLoad", "controls", null, null, null, null]
flowpl....min.js (line 24)
$f.fireEvent ["onLoad", "play", null, null, null, null]
flowpl....min.js (line 24)
$f.fireEvent ["onLoad", "player", null, null, null, null]
flowpl....min.js (line 24)
$f.fireEvent ["onBeforeBegin", 0, Object { autoPlay=true, extension="ahisa1", autoBuffering=false, more...}, null, null, null]
flowpl....min.js (line 24)
$f.fireEvent ["onBeforePluginEvent", "controls", "onBeforeHidden", null, null, null]
flowpl....min.js (line 24)
$f.fireEvent ["onPluginEvent", "controls", "onHidden", null, null, null]
flowpl....min.js (line 24)
$f.fireEvent ["onConnect", 0, null, null, null, null]
flowpl....min.js (line 24)
$f.fireEvent ["onBegin", 0, Object { autoPlay=true, extension="ahisa1", autoBuffering=false, more...}, null, null, null]
flowpl....min.js (line 24)
$f.fireEvent ["onMetaData", 0, Object { autoPlay=true, extension="ahisa1", autoBuffering=false, more...}, null, null, null]
flowpl....min.js (line 24)
$f.fireEvent ["onStart", 0, Object { autoPlay=true, extension="ahisa1", autoBuffering=false, more...}, null, null, null]
flowpl....min.js (line 24)
$f.fireEvent ["onResized", 0, null, null, null, null]
flowpl....min.js (line 24)
$f.fireEvent ["onBufferFull", 0, null, null, null, null]
flowpl....min.js (line 24)
$f.fireEvent ["onResized", 0, null, null, null, null]

Capture Error

Example of catching an error in Flowplayer and displaying a message to the user.

//on player object
onError: function()
{
    statusElem.html("Live stream not active.");
}

Error Codes

Here is a quick explanation of the different error codes in Flowplayer.

100 Plugin initialization failed
200 Stream not found
201 Unable to load stream or clip file
202 Provider specified in clip is not loaded
300 Player initialization failed
301 Unable to load plugin
302 Error when invoking plugin external method
303 Failed to load resource such as stylesheet or background image

Recommended

Learn Coding Online
Learn Web Development

Start learning web development and design for free with SitePoint Premium!

Get the latest in JavaScript, once a week, for free.