Skip to content
Open
Show file tree
Hide file tree
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
15 changes: 13 additions & 2 deletions scripts/youtube.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,17 +219,18 @@
var deferred = new $.Deferred();
var promise = deferred.promise();

var thisObj, ytTracks, i, trackLang, trackLabel, isDefaultTrack;
var thisObj, ytTracks, i, trackLang, trackLabel, isDefaultTrack, apiTriggered;

thisObj = this;
apiTriggered = false;

if (!this.youTubePlayer.getOption('captions','tracklist') ) {

// no tracks were found, probably because the captions module hasn't loaded
// play video briefly (required in order to load the captions module)
// and after the apiChange event is triggered, try again to retrieve tracks
this.youTubePlayer.addEventListener('onApiChange',function(x) {

apiTriggered = true;
// getDuration() also requires video to play briefly
// so, let's set that while we're here
thisObj.duration = thisObj.youTubePlayer.getDuration();
Expand Down Expand Up @@ -305,6 +306,16 @@
// Trigger the above event listener by briefly playing the video
this.loadingYouTubeCaptions = true;
this.youTubePlayer.playVideo();
setTimeout(() => {
if ( promise.state() === 'pending' && ! apiTriggered ){
setTimeout( () => {
// Code to be executed after a delay
thisObj.youTubePlayer.pauseVideo();
deferred.resolve();
}, 500 );
}
}, 500 );

}
return promise;
};
Expand Down
5 changes: 5 additions & 0 deletions styles/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,7 @@ div.able-wrapper.fullscreen {
/*
Popup Menus
*/
ul.able-popup,
.able ul.able-popup {
position: absolute;
margin: 0;
Expand All @@ -816,21 +817,25 @@ div.able-wrapper.fullscreen {
width: auto;
}

ul.able-popup li,
.able ul.able-popup li {
padding: 4px 16px;
margin: 0;
width: auto;
color: #fff;
}

ul.able-popup li:first-of-type,
.able ul.able-popup li:first-of-type {
border-radius: 5px 5px 0 0;
}

ul.able-popup li:last-of-type,
.able ul.able-popup li:last-of-type {
border-radius: 0 0 5px 5px;
}

ul.able-popup li.able-focus,
.able ul.able-popup li.able-focus {
background-color: #ccc;
color: #000;
Expand Down