Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add start and end parameters to queueing functions #61

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
40 changes: 37 additions & 3 deletions google-youtube.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
width: 100%;
height: 100%;
}

iframe {
@apply(--google-youtube-iframe);
}
Expand Down Expand Up @@ -334,6 +334,32 @@
fluid: {
type: Boolean,
value: false
},

/**
* This parameter causes the player to begin playing the video at the given number of seconds from the start
* of the video. The parameter value is a positive integer.
*
* Note that similar to the seekTo function, the player will look for the closest keyframe to the time you
* specify. This means that sometimes the play head may seek to just before the requested time, usually no more
* than around two seconds.
*/
start: {
type: Number,
value: 0
},

/**
* This parameter specifies the time, measured in seconds from the start of the video, when the player should
* stop playing the video. The parameter value is a positive integer.
*
* Note that the time is measured from the beginning of the video and not from either the value of the start
* player parameter or the startSeconds parameter, which is used in YouTube Player API functions for loading or
* queueing a video.
*/
end: {
type: Number,
value: 0
}

},
Expand Down Expand Up @@ -554,9 +580,17 @@
} else {
// Figure out whether we should cue or load (which will autoplay) the next video.
if (this.playsupported && this.attributes['autoplay'] && this.attributes['autoplay'].value == '1') {
this._player.loadVideoById(this.videoId);
this._player.loadVideoById({
videoId: this.videoId,
startSeconds: this.start,
endSeconds: this.end
});
} else {
this._player.cueVideoById(this.videoId);
this._player.cueVideoById({
videoId: this.videoId,
startSeconds: this.start,
endSeconds: this.end
});
}
}
},
Expand Down