1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
| <template>
| <view class="content">
| <video id="myVideo" style="width: 100%" preload=“auto” :src="videoUrl" @timeupdate="handleTimeChange" controls></video>
| </view>
| </template>
| <script>
|
| export default {
| data() {
| return {
| player: null,
| videoUrl: '',
| info: {},
| baseUrl: 'http://192.168.2.16:9000/trainexam/',
| videoContext: null
| }
| },
| onReady(){
|
| },
| mounted() {
|
| },
| created() {
|
| },
| methods: {
| handleTimeChange(e){
| this.$emit('update-time', e.target.currentTime);
| },
| reloadVideo(detail){
| if (this.videoContext) {
| this.videoContext.stop();
| this.videoContext = null;
| }
| this.videoContext = uni.createVideoContext('myVideo')
| this.videoUrl = this.baseUrl + detail.resourcePath
| this.videoContext.src = this.baseUrl + detail.resourcePath
| this.videoContext.play()
| }
| }
| }
| </script>
|
|