qa-deu-tv/pages/curriculum/play.vue

51 lines
948 B
Vue
Raw Normal View History

2024-12-13 08:38:32 +08:00
<template>
<unitv-page
id="curriculumPlayPage"
ref="curriculumPlayPage"
class="curriculumPlayPage"
:show="true"
>
<unitv-video
id="player"
:src="url"
:title="title"
:initial-time="time"
@timeupdate="fnTimeupdate"
/>
</unitv-page>
</template>
<script>
export default {
data() {
return {
videoContext: null,
url: "",
title: "",
time: 0,
};
},
onLoad(query) {
this.url = query.url;
this.title = query.title;
this.time = +query.time;
},
onReady() {
this.videoContext = uni.createVideoContext("player");
this.videoContext.play();
this.videoContext.seek(this.time);
},
onUnload() {
const eventChannel = this.getOpenerEventChannel();
eventChannel.emit("timeupdate", { time: this.time });
},
methods: {
fnTimeupdate(time) {
this.time = time;
},
},
};
</script>
<style scoped lang="scss"></style>