0
我使用視頻html5元素獲取持續時間屬性以查找最後一次視頻在用戶關閉瀏覽器或用戶暫停時停止播放的位置 將其發送到數據庫稍後它將從停止的地方恢復。使用jquery(Html5視頻元素)恢復視頻
目前我用Google搜索和檢查堆棧溢出是這樣
<script type="text/javascript">
$("#video").on("durationchange", function() {
alert("Current duration is: " + this.duration);
});
</script>
<video id="video" poster="image.jpg" controls>
<source src="video_path.mp4" type="video/mp4" />
</video>
我也想尋求到視頻到用戶登錄 到我的應用程序後,停止時間。我試了一下,但沒有做
$(window).load(function() {
.ajax({
type: "GET",
url: "/api/videoResume/",
data: param = "",
contentType: "application/json; charset=utf-8",
dataType: "json"
})
.done(function(result){
//update the video element duration
//seeking video to the duration
})
});
'window.onbeforeunload = video.onpause = E => postToYourServer(video.currentTime)' – Kaiido