Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions components/course/Video.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
></iframe>

<video
ref="video"
v-else-if="activeLecture.type == 'mp4'"
:poster="course.image"
controls
Expand All @@ -19,7 +20,7 @@
allowfullscreen
controlsList="nodownload"
oncontextmenu="return false;"
:key="`video-${activeLecture.id}`"
:key="`video-${videoSRC}`"
>
<track kind="captions" />
<source ref="refSource" :src="videoSRC" type="video/mp4" />
Expand Down Expand Up @@ -53,6 +54,7 @@ export default defineComponent({

let videoInterval: any;
const refSource = ref<HTMLSourceElement | any>(null);
const video = ref<HTMLVideoElement | null>(null);

watch(
() => props.activeLecture,
Expand All @@ -71,15 +73,22 @@ export default defineComponent({
refSource.value.setAttribute("src", videoSRC.value);
videoInterval = setInterval(async () => {
await getLectureVideoSRC(courseID, newValue);
if (video.value) {
video.value.pause();
refSource.value.src = videoSRC.value;
video.value.load();
video.value.play();
};
// refSource.value.setAttribute('src', videoSRC.value);
refSource.value.src = videoSRC.value;
}, 40000);
}, 28800000); //8 hours
}
},
{ deep: true, immediate: true }
);

return { videoSRC, refSource };

return { videoSRC, refSource, video };
},
});
</script>
Expand Down