Skip to content

Commit 042cd8c

Browse files
author
surmon
committedJan 17, 2018
update
1 parent 099f905 commit 042cd8c

File tree

7 files changed

+33
-10
lines changed

7 files changed

+33
-10
lines changed
 

‎CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11

22
## CHANGELOG
33

4+
### v5.0.1
5+
6+
support dynamic change options
7+
48
### v5.0.0
59

610
#### use

‎dist/ssr.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ var videoPlayerDirective = function videoPlayerDirective(globalOptions) {
6363
el.children[0].setAttribute('x5-video-player-fullscreen', false);
6464
}
6565

66-
if (!!attrs.crossOrigin) {
66+
if (attrs.crossOrigin) {
6767
el.children[0].crossOrigin = attrs.crossOrigin;
6868
el.children[0].setAttribute('crossOrigin', attrs.crossOrigin);
6969
}

‎dist/vue-video-player.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎examples/01-video.vue

+16-1
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,23 @@
6464
// console.log('this is current player instance object', this.player)
6565
setTimeout(() => {
6666
console.log('dynamic change options', this.player)
67+
68+
// change src
69+
// this.playerOptions.sources[0].src = 'https://cdn.theguardian.tv/webM/2015/07/20/150716YesMen_synd_768k_vp8.webm';
70+
71+
// change item
72+
// this.$set(this.playerOptions.sources, 0, {
73+
// type: "video/mp4",
74+
// src: 'https://cdn.theguardian.tv/webM/2015/07/20/150716YesMen_synd_768k_vp8.webm',
75+
// })
76+
77+
// change array
78+
// this.playerOptions.sources = [{
79+
// type: "video/mp4",
80+
// src: 'https://cdn.theguardian.tv/webM/2015/07/20/150716YesMen_synd_768k_vp8.webm',
81+
// }]
6782
this.player.muted(false)
68-
}, 2000)
83+
}, 5000)
6984
},
7085
computed: {
7186
player() {

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "vue-video-player",
33
"description": "video.js component for Vue",
4-
"version": "5.0.0",
4+
"version": "5.0.1",
55
"license": "MIT",
66
"private": false,
77
"author": {

‎src/player.vue

+9-5
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
self.$emit('ready', this)
187187
})
188188
},
189-
dispose() {
189+
dispose(callback) {
190190
if (this.player && this.player.dispose) {
191191
if (this.player.techName_ !== 'Flash') {
192192
this.player.pause && this.player.pause()
@@ -197,6 +197,9 @@
197197
this.reseted = false
198198
this.$nextTick(() => {
199199
this.reseted = true
200+
this.$nextTick(() => {
201+
callback && callback();
202+
})
200203
})
201204
})
202205
/*
@@ -213,10 +216,11 @@
213216
options: {
214217
deep: true,
215218
handler(options, oldOptions) {
216-
this.dispose()
217-
if (options && options.sources && options.sources.length) {
218-
this.initialize()
219-
}
219+
this.dispose(() => {
220+
if (options && options.sources && options.sources.length) {
221+
this.initialize()
222+
}
223+
})
220224
}
221225
}
222226
}

‎src/ssr.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ const videoPlayerDirective = globalOptions => {
7474
}
7575

7676
// cross origin
77-
if (!!attrs.crossOrigin) {
77+
if (attrs.crossOrigin) {
7878
el.children[0].crossOrigin = attrs.crossOrigin
7979
el.children[0].setAttribute('crossOrigin', attrs.crossOrigin)
8080
}

0 commit comments

Comments
 (0)
Please sign in to comment.