Detect when an HTML5 video finishes

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

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

7条回答
  •  南方客
    南方客 (楼主)
    2020-11-22 06:36

    Here is a simple approach which triggers when the video ends.

    
    
    
        
    
    
    
     
    

    In the 'EventListener' line substitute the word 'ended' with 'pause' or 'play' to capture those events as well.

提交回复
热议问题