|
1 | 1 | (function ($) { |
2 | 2 | AblePlayer.prototype.initSignLanguage = function() { |
| 3 | + this.hasSignLanguage = false; |
3 | 4 | // Sign language is only currently supported in HTML5 player and YouTube. |
4 | 5 | var hasLocalSrc = ( this.$media.data('sign-src') !== undefined && this.$media.data('sign-src') !== "" ); |
| 6 | + // YouTube src can either be on a `source` element or on the `video` element. |
5 | 7 | var hasRemoteSrc = ( this.$media.data('youtube-sign-src') !== undefined && this.$media.data('youtube-sign-src') !== "" ); |
6 | | - if ( ! this.isIOS() && ( hasLocalSrc || hasRemoteSrc ) ) { |
7 | | - this.hasSignLanguage = true; |
8 | | - if ( hasRemoteSrc ) { |
9 | | - this.signYoutubeId = this.youTubeSignId; |
10 | | - } |
11 | | - } |
12 | | - if (this.player === 'html5' || this.player === 'youtube' ) { |
| 8 | + var hasRemoteSource = ( this.$sources.first().attr('data-youtube-sign-src') !== undefined && this.$sources.first().attr('data-youtube-sign-src') !== '' ); |
| 9 | + if ( ! this.isIOS() && ( hasLocalSrc || hasRemoteSrc || hasRemoteSource ) && ( this.player === 'html5' || this.player === 'youtube' ) ) { |
13 | 10 | // check to see if there's a sign language video accompanying this video |
14 | 11 | // check only the first source |
15 | 12 | // If sign language is provided, it must be provided for all sources |
16 | | - this.signYoutubeId = this.youTubeSignId ?? DOMPurify.sanitize( this.$sources.first().attr('data-youtube-sign-src') ); |
| 13 | + let ytSignSrc = this.youTubeSignId ?? DOMPurify.sanitize( this.$sources.first().attr('data-youtube-sign-src') ); |
17 | 14 | let signSrc = DOMPurify.sanitize( this.$sources.first().attr('data-sign-src') ); |
18 | 15 | let signVideo = DOMPurify.sanitize( this.$media.data('youtube-sign-src') ); |
19 | | - this.signFile = ( signVideo ) ? signVideo : signSrc; |
20 | | - if (this.signFile || this.signYoutubeId) { |
| 16 | + this.signFile = (hasLocalSrc ) ? signSrc : false; |
| 17 | + if ( hasRemoteSrc ) { |
| 18 | + this.signYoutubeId = signVideo; |
| 19 | + } else if ( hasRemoteSource ) { |
| 20 | + this.signYoutubeId = ytSignSrc; |
| 21 | + } |
| 22 | + if ( this.signFile || this.signYoutubeId ) { |
21 | 23 | if (this.isIOS()) { |
22 | 24 | // iOS does not allow multiple videos to play simultaneously |
23 | 25 | // Therefore, sign language as rendered by Able Player unfortunately won't work |
24 | | - this.hasSignLanguage = false; |
25 | 26 | if (this.debug) { |
26 | 27 | console.log('Sign language has been disabled due to iOS restrictions'); |
27 | 28 | } |
|
32 | 33 | this.hasSignLanguage = true; |
33 | 34 | this.injectSignPlayerCode(); |
34 | 35 | } |
35 | | - } else { |
36 | | - this.hasSignLanguage = false; |
37 | 36 | } |
38 | | - } else { |
39 | | - this.hasSignLanguage = false; |
40 | 37 | } |
41 | 38 | }; |
42 | 39 |
|
|
0 commit comments