HTML5 video error handling

前端 未结 6 1134
一整个雨季
一整个雨季 2020-12-09 02:50

I need to tell, whether video cannot be played (\"x\" sign is shown in browser).

This code does\'t works. \"onerror\" event will never be fired under Firefox

6条回答
  •  北荒
    北荒 (楼主)
    2020-12-09 03:34

    Pug example

    video(src= encodeURI(item.urlVideo), type='video/mp4'  onerror="myFunction('param',this)")
    script(src='/javascripts/onerror.js')
    
    function myFunction(param, me) { 
        console.log(me);
        me.poster = './images/placeholder.jpg'; }
    

提交回复
热议问题