Detect when an HTML5 video finishes

前端 未结 7 2078
死守一世寂寞
死守一世寂寞 2020-11-22 05:45

How do you detect when a HTML5 element has finished playing?

7条回答
  •  余生分开走
    2020-11-22 06:38

    Have a look at this Everything You Need to Know About HTML5 Video and Audio post at the Opera Dev site under the "I want to roll my own controls" section.

    This is the pertinent section:

    
    

    then you can use:

    
    

    onended is a HTML5 standard event on all media elements, see the HTML5 media element (video/audio) events documentation.

提交回复
热议问题