add support for shadowbox videos with start time specified with #t= in video url

Change-Id: I165620326f44f8e95bb34a2b623e67fc3b7dcc50
This commit is contained in:
smain@google.com 2014-11-25 19:01:40 -08:00
parent ccb540081c
commit 570c2210b8
1 changed files with 7 additions and 1 deletions

View File

@ -593,11 +593,17 @@ function onYouTubeIframeAPIReady() {
}
function startYouTubePlayer(videoId) {
var idAndHash = videoId.split("#");
var startTime = 0;
if (idAndHash.length > 1) {
startTime = idAndHash[1].split("t=")[1] != undefined ? idAndHash[1].split("t=")[1] : 0;
}
if (youTubePlayer == null) {
youTubePlayer = new YT.Player('youTubePlayer', {
height: '529',
width: '940',
videoId: videoId,
videoId: idAndHash[0],
playerVars: {start: startTime},
events: {
'onReady': onPlayerReady,
'onStateChange': onPlayerStateChange