How to check if HTML5 audio has reached different errors

前端 未结 3 1905
傲寒
傲寒 2020-12-02 17:47

Specifically, if one of the 206 requests for audio fails and buffering stops, is there a way to detect that state? Or should I have to check if buffering stopped by comparin

3条回答
  •  暖寄归人
    2020-12-02 17:58

    There is a complete list of the events handled by media elements in the spec: https://html.spec.whatwg.org/multipage/embedded-content.html#media-elements

    I would look specifically at the stalled, abort, progress events.

    Since this element is relatively new implementations may vary greatly. So I would test these events against the platforms you are targeting to see if they work as expected for your needs. If not you may need to do something a bit more manual like polling the buffered state as you had mentioned.

提交回复
热议问题