Skip to content

Commit 6640a54

Browse files
committed
Commit builds.
1 parent c39bccd commit 6640a54

17 files changed

Lines changed: 633 additions & 41 deletions

‎build/ableplayer.dist.js‎

Lines changed: 123 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2731,6 +2731,14 @@
27312731
if (vimeoDescId !== undefined && vimeoDescId !== "") {
27322732
this.vimeoDescId = this.getVimeoId(vimeoDescId);
27332733
}
2734+
let vimeoSignId = options.vimeoSignId ?? data.vimeoSignSrc;
2735+
if (vimeoSignId !== undefined && vimeoSignId !== "") {
2736+
// getVimeoId() sets a shared flag; keep the main video's value.
2737+
let mainUrlHasParams = this.vimeoUrlHasParams;
2738+
this.vimeoSignId = this.getVimeoId(vimeoSignId);
2739+
this.vimeoSignUrlHasParams = this.vimeoUrlHasParams;
2740+
this.vimeoUrlHasParams = mainUrlHasParams;
2741+
}
27342742

27352743
// Skin
27362744
let skin = options.skin ?? data.skin;
@@ -6519,6 +6527,29 @@
65196527
};
65206528

65216529
AblePlayer.prototype.syncSignVideo = function(options) {
6530+
if (this.hasSignLanguage && this.vimeoSignPlayer && options) {
6531+
const sign = this.vimeoSignPlayer;
6532+
const thisObj = this;
6533+
const ignore = function(error) {
6534+
if (thisObj.debug) ;
6535+
};
6536+
if (typeof options.time !== 'undefined') {
6537+
sign.setCurrentTime(options.time).catch(ignore);
6538+
}
6539+
if (typeof options.rate !== 'undefined') {
6540+
sign.setPlaybackRate(options.rate).catch(ignore);
6541+
}
6542+
if (typeof options.pause !== 'undefined') {
6543+
sign.pause().catch(ignore);
6544+
}
6545+
if (typeof options.play !== 'undefined') {
6546+
sign.play().catch(ignore);
6547+
}
6548+
if (typeof options.volume !== 'undefined') {
6549+
sign.setVolume(0).catch(ignore);
6550+
}
6551+
return;
6552+
}
65226553
if (this.hasSignLanguage && ( this.signVideo || this.signYoutube ) ) {
65236554
if (options && typeof options.time !== 'undefined') {
65246555
if ( this.signVideo ) {
@@ -10092,6 +10123,7 @@
1009210123
thisObj.startedPlaying = true;
1009310124
thisObj.paused = false;
1009410125
thisObj.refreshControls('playpause');
10126+
thisObj.syncSignVideo( { 'play' : true } );
1009510127
});
1009610128
this.vimeoPlayer.on('ended', function(e) {
1009710129
// Triggered any time the video playback reaches the end.
@@ -10145,6 +10177,7 @@
1014510177
thisObj.clickedPlay = false; // done with this variable
1014610178
thisObj.onMediaPause();
1014710179
thisObj.refreshControls('playpause');
10180+
thisObj.syncSignVideo( { 'pause' : true } );
1014810181
});
1014910182
this.vimeoPlayer.on('playbackratechange',function(e) {
1015010183
// Triggered when the playback rate of the video in the player changes.
@@ -12468,6 +12501,49 @@
1246812501
}
1246912502
};
1247012503

12504+
// Migrate a legacy Able-Player cookie into localStorage, then delete the cookie.
12505+
// Only used when the Cookies library is unavailable.
12506+
AblePlayer.prototype.migrateCookiePrefs = function() {
12507+
var match = document.cookie.match( /(?:^|;\s*)Able-Player=([^;]*)/ );
12508+
if ( ! match ) {
12509+
return;
12510+
}
12511+
try {
12512+
var parsed = JSON.parse( decodeURIComponent( match[1] ) );
12513+
if ( parsed && typeof parsed === 'object' && ! Array.isArray( parsed ) ) {
12514+
// Copy only expected keys, with expected types.
12515+
var clean = {
12516+
preferences: {},
12517+
sign: {},
12518+
transcript: {},
12519+
voices: []
12520+
};
12521+
[ 'preferences', 'sign', 'transcript' ].forEach( function( key ) {
12522+
if ( parsed[key] && typeof parsed[key] === 'object' && ! Array.isArray( parsed[key] ) ) {
12523+
Object.keys( parsed[key] ).forEach( function( k ) {
12524+
if ( k !== '__proto__' && k !== 'constructor' && k !== 'prototype' ) {
12525+
clean[key][k] = parsed[key][k];
12526+
}
12527+
} );
12528+
}
12529+
} );
12530+
if ( Array.isArray( parsed.voices ) ) {
12531+
clean.voices = parsed.voices;
12532+
}
12533+
// Don't overwrite preferences already in localStorage.
12534+
if ( localStorage.getItem( 'Able-Player' ) === null ) {
12535+
localStorage.setItem( 'Able-Player', JSON.stringify( clean ) );
12536+
}
12537+
}
12538+
} catch ( err ) {
12539+
// Invalid cookie; discard it.
12540+
}
12541+
var secure = location.protocol === 'https:' ? '; Secure' : '';
12542+
var expired = 'Able-Player=; expires=Thu, 01 Jan 1970 00:00:00 GMT; SameSite=Strict' + secure;
12543+
document.cookie = expired + '; path=/';
12544+
document.cookie = expired;
12545+
};
12546+
1247112547
AblePlayer.prototype.getPref = function() {
1247212548

1247312549
var defaultPrefs = {
@@ -12482,6 +12558,7 @@
1248212558
if ( typeof Cookies !== 'undefined' ) {
1248312559
preferences = JSON.parse( Cookies.get('Able-Player') );
1248412560
} else {
12561+
this.migrateCookiePrefs();
1248512562
preferences = JSON.parse( localStorage.getItem('Able-Player') );
1248612563
}
1248712564
}
@@ -13979,22 +14056,31 @@
1397914056
};
1398014057
}
1398114058

13982-
/* global YT */
14059+
/* global YT, Vimeo */
1398314060

1398414061
function addSignFunctions(AblePlayer) {
1398514062
AblePlayer.prototype.initSignLanguage = function() {
13986-
let firstSource, localSignSrc, remoteSignSrc, hasLocalSrc, hasRemoteSrc, hasRemoteSource, ytSignSrc, signSrc, signVideo;
14063+
let firstSource, localSignSrc, remoteSignSrc, vimeoSignSrc, hasLocalSrc, hasRemoteSrc, hasRemoteSource, hasVimeoSign, ytSignSrc, signSrc, signVideo;
1398714064

1398814065
this.hasSignLanguage = false;
13989-
// Sign language is only currently supported in HTML5 player and YouTube.
14066+
// Sign language is supported on all players.
1399014067
firstSource = this.sources[0] ?? null;
1399114068
localSignSrc = firstSource ? firstSource.getAttribute('data-sign-src') : null;
1399214069
remoteSignSrc = firstSource ? firstSource.getAttribute('data-youtube-sign-src') : null;
14070+
vimeoSignSrc = firstSource ? firstSource.getAttribute('data-vimeo-sign-src') : null;
1399314071
hasLocalSrc = ( localSignSrc !== null && localSignSrc !== "" );
1399414072
// YouTube src can either be on a `source` element or on the `video` element.
1399514073
hasRemoteSrc = ( this.$media.data('youtube-sign-src') !== undefined && this.$media.data('youtube-sign-src') !== "" );
1399614074
hasRemoteSource = ( remoteSignSrc !== null && remoteSignSrc !== '' );
13997-
if ( ! this.isIOS() && ( hasLocalSrc || hasRemoteSrc || hasRemoteSource ) && ( this.player === 'html5' || this.player === 'youtube' ) ) {
14075+
// Vimeo src can also be on either element.
14076+
if ( ! this.vimeoSignId && vimeoSignSrc ) {
14077+
let mainUrlHasParams = this.vimeoUrlHasParams;
14078+
this.vimeoSignId = this.getVimeoId( vimeoSignSrc );
14079+
this.vimeoSignUrlHasParams = this.vimeoUrlHasParams;
14080+
this.vimeoUrlHasParams = mainUrlHasParams;
14081+
}
14082+
hasVimeoSign = !! this.vimeoSignId;
14083+
if ( ! this.isIOS() && ( hasLocalSrc || hasRemoteSrc || hasRemoteSource || hasVimeoSign ) && ( this.player === 'html5' || this.player === 'youtube' || this.player === 'vimeo' ) ) {
1399814084
// check to see if there's a sign language video accompanying this video
1399914085
// check only the first source
1400014086
// If sign language is provided, it must be provided for all sources
@@ -14007,7 +14093,7 @@
1400714093
} else if ( hasRemoteSource ) {
1400814094
this.signYoutubeId = ytSignSrc;
1400914095
}
14010-
if ( this.signFile || this.signYoutubeId ) {
14096+
if ( this.signFile || this.signYoutubeId || this.vimeoSignId ) {
1401114097
if (this.isIOS()) {
1401214098
// iOS does not allow multiple videos to play simultaneously
1401314099
// Therefore, sign language as rendered by Able Player unfortunately won't work
@@ -14028,7 +14114,7 @@
1402814114

1402914115
signVideoId = this.mediaId + '-sign';
1403014116

14031-
if ( this.signFile || this.signYoutubeId ) {
14117+
if ( this.signFile || this.signYoutubeId || this.vimeoSignId ) {
1403214118
if ( null !== this.$signDivLocation ) {
1403314119
this.$signDivLocation.addClass( 'able-sign-window able-fixed' );
1403414120
this.$signWindow = this.$signDivLocation;
@@ -14086,6 +14172,8 @@
1408614172
this.$signWindow.append( this.$signVideo );
1408714173
} else if ( this.signYoutubeId ) {
1408814174
this.signYoutube = this.initYouTubeSignPlayer();
14175+
} else if ( this.vimeoSignId ) {
14176+
this.signVimeo = this.initVimeoSignPlayer();
1408914177
}
1409014178

1409114179
// make it draggable
@@ -14104,6 +14192,35 @@
1410414192
};
1410514193

1410614194

14195+
AblePlayer.prototype.initVimeoSignPlayer = function () {
14196+
14197+
var thisObj, containerId, id, options;
14198+
thisObj = this;
14199+
containerId = this.mediaId + '_vimeo_sign';
14200+
id = purify.sanitize( String( this.vimeoSignId ) );
14201+
14202+
this.vimeoSignPlayerReady = false;
14203+
this.$signWindow.append( $('<div>').attr('id', containerId) );
14204+
14205+
options = this.vimeoSignUrlHasParams ? { url: id } : { id: id };
14206+
options.controls = false;
14207+
options.muted = true;
14208+
options.autoplay = false;
14209+
14210+
this.vimeoSignPlayer = new Vimeo.Player( containerId, options );
14211+
return this.vimeoSignPlayer.ready().then( function() {
14212+
$('#' + containerId).children('iframe').attr({
14213+
'tabindex': '-1',
14214+
'aria-hidden': true
14215+
});
14216+
thisObj.vimeoSignPlayer.setVolume(0).catch(function() {});
14217+
if ( thisObj.startTime ) {
14218+
thisObj.vimeoSignPlayer.setCurrentTime( thisObj.startTime ).catch(function() {});
14219+
}
14220+
thisObj.vimeoSignPlayerReady = true;
14221+
}).catch( function() {} );
14222+
};
14223+
1410714224
AblePlayer.prototype.initYouTubeSignPlayer = function () {
1410814225

1410914226
var thisObj, deferred, promise;

‎build/ableplayer.dist.js.map‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎build/ableplayer.esm.d.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ declare class AblePlayer {
5555
youTubeNoCookie: boolean;
5656
vimeoId: any;
5757
vimeoDescId: any;
58+
vimeoSignId: any;
59+
vimeoSignUrlHasParams: any;
60+
vimeoUrlHasParams: any;
5861
skin: string;
5962
playerWidth: number;
6063
allowFullscreen: boolean;

‎build/ableplayer.esm.d.ts.map‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)