tags:

views:

33

answers:

1

Hi,

How can I make a trigger that runs if JW Player returns any error.

for example, when jw player says "video not found", i want to run a ajax function.

A: 

There are a few steps here, but the process is basically as follows:

  • Wait for the player to be ready
  • Add an error event listener with a callback function
  • Your callback function will be triggered when an error occurs.

The code for that looks something like this:

<script type="text/javascript">
    var player;

    function playerReady(obj) {
    player = document.getElementById(obj['id']);
        player.addModelListener('ERROR', errorHandler);
    };

    function errorHandler(evt){
        //Your Code Here
    }
</script>

You should check out the documentation for more information on events you can listen for and adding event listeners.

Best,

Zach

Developer, LongTail Video

zach at longtail