html5-video by button $(…).play is not a function

前端 未结 1 449
无人及你
无人及你 2021-02-12 14:50

I try to play videos one after the other via button or automatically at the end of the video. by this code:

//automatically play
$(\"#videoPlayer\").bind(\'ended         


        
相关标签:
1条回答
  • 2021-02-12 15:33

    $('#videoPlayer') gives you a jQuery object and the jQuery object does not have a play method. The play method you are looking for is in the native dom element inside the jQuery object. To get access to the element inside just use array syntax or .get(). e.g. $('#videoPlayer')[0].play(); or $('#videoPlayer').get(0).play();

    0 讨论(0)
提交回复
热议问题