Skip to content

Commit

Permalink
feat: ensure start and end parameters are used when videoId is updated (
Browse files Browse the repository at this point in the history
  • Loading branch information
Frank3K authored Feb 3, 2021
1 parent 4f8c940 commit 585299c
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 14 deletions.
16 changes: 13 additions & 3 deletions dist/vue-youtube.common.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* vue-youtube v1.4.0
* (c) 2019 Antério Vieira
* (c) 2021 Antério Vieira
* Released under the MIT License.
*/

Expand Down Expand Up @@ -140,12 +140,22 @@ var Youtube = {
return
}

var params = { videoId: videoId };

if (typeof this.playerVars.start === 'number') {
params.startSeconds = this.playerVars.start;
}

if (typeof this.playerVars.end === 'number') {
params.endSeconds = this.playerVars.end;
}

if (this.playerVars.autoplay === 1) {
this.player.loadVideoById({ videoId: videoId });
this.player.loadVideoById(params);
return
}

this.player.cueVideoById({ videoId: videoId });
this.player.cueVideoById(params);
},
resizeProportionally: function resizeProportionally () {
var this$1 = this;
Expand Down
16 changes: 13 additions & 3 deletions dist/vue-youtube.esm.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* vue-youtube v1.4.0
* (c) 2019 Antério Vieira
* (c) 2021 Antério Vieira
* Released under the MIT License.
*/

Expand Down Expand Up @@ -136,12 +136,22 @@ var Youtube = {
return
}

var params = { videoId: videoId };

if (typeof this.playerVars.start === 'number') {
params.startSeconds = this.playerVars.start;
}

if (typeof this.playerVars.end === 'number') {
params.endSeconds = this.playerVars.end;
}

if (this.playerVars.autoplay === 1) {
this.player.loadVideoById({ videoId: videoId });
this.player.loadVideoById(params);
return
}

this.player.cueVideoById({ videoId: videoId });
this.player.cueVideoById(params);
},
resizeProportionally: function resizeProportionally () {
var this$1 = this;
Expand Down
16 changes: 13 additions & 3 deletions dist/vue-youtube.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* vue-youtube v1.4.0
* (c) 2019 Antério Vieira
* (c) 2021 Antério Vieira
* Released under the MIT License.
*/

Expand Down Expand Up @@ -142,12 +142,22 @@ var Youtube = {
return
}

var params = { videoId: videoId };

if (typeof this.playerVars.start === 'number') {
params.startSeconds = this.playerVars.start;
}

if (typeof this.playerVars.end === 'number') {
params.endSeconds = this.playerVars.end;
}

if (this.playerVars.autoplay === 1) {
this.player.loadVideoById({ videoId: videoId });
this.player.loadVideoById(params);
return
}

this.player.cueVideoById({ videoId: videoId });
this.player.cueVideoById(params);
},
resizeProportionally: function resizeProportionally () {
var this$1 = this;
Expand Down
4 changes: 2 additions & 2 deletions dist/vue-youtube.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 13 additions & 3 deletions src/vue-youtube.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,22 @@ export default {
return
}

const params = { videoId: videoId }

if (typeof this.playerVars.start === 'number') {
params.startSeconds = this.playerVars.start
}

if (typeof this.playerVars.end === 'number') {
params.endSeconds = this.playerVars.end
}

if (this.playerVars.autoplay === 1) {
this.player.loadVideoById({ videoId })
this.player.loadVideoById(params)
return
}

this.player.cueVideoById({ videoId })
this.player.cueVideoById(params)
},
resizeProportionally () {
this.player.getIframe().then(iframe => {
Expand Down Expand Up @@ -133,7 +143,7 @@ export default {
window.YTConfig = {
host: 'https://www.youtube.com/iframe_api'
}

const host = this.nocookie ? 'https://www.youtube-nocookie.com' : 'https://www.youtube.com'

this.player = player(this.$el, {
Expand Down

0 comments on commit 585299c

Please sign in to comment.