make html5 video go to first frame when it ends?

前端 未结 2 1106
轮回少年
轮回少年 2020-12-17 03:31

I have a simple video html5 tag, bound to an \"ended\" event:

$(\'#video\').show().trigger(\"play\").bind(\'ended\', function () { 
//code
}
<
2条回答
  •  情深已故
    2020-12-17 03:57

    You can use something like

    $('#video').show().trigger("play").bind('ended', function () { 
        this.currentTime = 0;
    }
    

    You can only set the currentTime if the loadedmetadata event has passed.

提交回复
热议问题