开发者

JW Flv Player Error handling

开发者 https://www.devze.com 2023-01-10 10:23 出处:网络
How can I make a trigger that runs if JW Player returns any error. for example, when jw player says \"video not found\"开发者_Python百科, i want to run a ajax function.There are a few steps here, but

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

for example, when jw player says "video not found"开发者_Python百科, i want to run a ajax function.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消