@@ -5813,11 +5813,14 @@ if (thisObj.useTtml && (trackSrc.endsWith('.xml') || trackText.startsWith('<?xml
58135813 onError : function ( x ) {
58145814 deferred . fail ( ) ;
58155815 } ,
5816- onStateChange : function ( x ) {
5816+ onStateChange : function ( x ) {
58175817 thisObj . getPlayerState ( ) . then ( function ( playerState ) {
58185818
58195819 // values of playerState: 'playing','paused','buffering','ended'
58205820 if ( playerState === 'playing' ) {
5821+ if ( thisObj . hasSignLanguage && thisObj . signVideo ) {
5822+ thisObj . signVideo . play ( true ) ;
5823+ }
58215824 thisObj . playing = true ;
58225825 thisObj . startedPlaying = true ;
58235826 thisObj . paused = false ;
@@ -5833,6 +5836,9 @@ if (thisObj.useTtml && (trackSrc.endsWith('.xml') || trackText.startsWith('<?xml
58335836 if ( typeof thisObj . $posterImg !== 'undefined' ) {
58345837 thisObj . $posterImg . show ( ) ;
58355838 }
5839+ if ( thisObj . hasSignLanguage && thisObj . signVideo ) {
5840+ thisObj . signVideo . pause ( true ) ;
5841+ }
58365842 thisObj . stoppingYouTube = false ;
58375843 thisObj . seeking = false ;
58385844 thisObj . playing = false ;
@@ -8020,6 +8026,10 @@ if (thisObj.useTtml && (trackSrc.endsWith('.xml') || trackText.startsWith('<?xml
80208026
80218027 this . seeking = true ;
80228028 this . liveUpdatePending = true ;
8029+ if ( this . hasSignLanguage && this . signVideo ) {
8030+ // keep sign languge video in sync
8031+ this . signVideo . currentTime = this . startTime ;
8032+ }
80238033 if ( this . player === 'html5' ) {
80248034 var seekable ;
80258035
@@ -8351,12 +8361,11 @@ if (thisObj.useTtml && (trackSrc.endsWith('.xml') || trackText.startsWith('<?xml
83518361 AblePlayer . prototype . pauseMedia = function ( ) {
83528362
83538363 var thisObj = this ;
8354-
8364+ if ( this . hasSignLanguage && this . signVideo ) {
8365+ this . signVideo . pause ( true ) ;
8366+ }
83558367 if ( this . player === 'html5' ) {
83568368 this . media . pause ( true ) ;
8357- if ( this . hasSignLanguage && this . signVideo ) {
8358- this . signVideo . pause ( true ) ;
8359- }
83608369 }
83618370 else if ( this . player === 'youtube' ) {
83628371 this . youTubePlayer . pauseVideo ( ) ;
@@ -8369,12 +8378,12 @@ if (thisObj.useTtml && (trackSrc.endsWith('.xml') || trackText.startsWith('<?xml
83698378 AblePlayer . prototype . playMedia = function ( ) {
83708379
83718380 var thisObj = this ;
8372-
8381+ if ( this . hasSignLanguage && this . signVideo ) {
8382+ this . signVideo . play ( true ) ;
8383+ }
83738384 if ( this . player === 'html5' ) {
83748385 this . media . play ( true ) ;
8375- if ( this . hasSignLanguage && this . signVideo ) {
8376- this . signVideo . play ( true ) ;
8377- }
8386+
83788387 }
83798388 else if ( this . player === 'youtube' ) {
83808389 this . youTubePlayer . playVideo ( ) ;
@@ -13454,7 +13463,11 @@ if (thisObj.useTtml && (trackSrc.endsWith('.xml') || trackText.startsWith('<?xml
1345413463
1345513464( function ( $ ) {
1345613465 AblePlayer . prototype . initSignLanguage = function ( ) {
13457-
13466+ if ( ! this . isIOS ( ) && this . $media . data ( 'sign-src' ) !== undefined && this . $media . data ( 'sign-src' ) !== "" ) {
13467+ this . hasSignLanguage = true ;
13468+ this . injectSignPlayerCode ( ) ;
13469+ return ;
13470+ }
1345813471 // Sign language is only currently supported in HTML5 player, not YouTube or Vimeo
1345913472 if ( this . player === 'html5' ) {
1346013473 // check to see if there's a sign language video accompanying this video
@@ -13503,22 +13516,46 @@ if (thisObj.useTtml && (trackSrc.endsWith('.xml') || trackText.startsWith('<?xml
1350313516 'tabindex' : '-1'
1350413517 } ) ;
1350513518 this . signVideo = this . $signVideo [ 0 ] ;
13506- // for each original <source>, add a <source> to the sign <video>
13507- for ( i = 0 ; i < this . $sources . length ; i ++ ) {
13519+ if ( this . $media . data ( 'sign-src' ) )
1350813520 signSrc = this . $sources [ i ] . getAttribute ( 'data-sign-src' ) ;
13521+ {
1350913522 srcType = this . $sources [ i ] . getAttribute ( 'type' ) ;
13523+ $signSource = $ ( '<source>' , {
1351013524 if ( signSrc ) {
13525+ 'src' : this . $media . data ( 'sign-src' ) ,
1351113526 $signSource = $ ( '<source>' , {
13527+ 'type' : 'video/' + this . $media . data ( 'sign-src' ) . substr ( - 3 )
1351213528 'src' : signSrc ,
13529+ } ) ;
1351313530 'type' : srcType
13531+ this . $signVideo . append ( $signSource ) ;
1351413532 } ) ;
13533+ }
1351513534 this . $signVideo . append ( $signSource ) ;
13535+ else {
1351613536 }
13537+ // for each original <source>, add a <source> to the sign <video>
1351713538 else {
13539+ for ( i = 0 ; i < this . $sources . length ; i ++ ) {
1351813540 // source is missing a sign language version
13541+ signSrc = this . $sources [ i ] . getAttribute ( 'data-sign-src' ) ;
1351913542 // can't include sign language
13543+ srcType = this . $sources [ i ] . getAttribute ( 'type' ) ;
1352013544 this . hasSignLanguage = false ;
13545+ if ( signSrc ) {
1352113546 break ;
13547+ $signSource = $ ( '<source>' , {
13548+ 'src' : signSrc ,
13549+ 'type' : srcType
13550+ } ) ;
13551+ this . $signVideo . append ( $signSource ) ;
13552+ }
13553+ else {
13554+ // source is missing a sign language version
13555+ // can't include sign language
13556+ this . hasSignLanguage = false ;
13557+ return ;
13558+ }
1352213559 }
1352313560 }
1352413561
0 commit comments