|
102 | 102 | this.youtubeId = $(media).data('youtube-id'); |
103 | 103 | } |
104 | 104 |
|
105 | | - if ($(media).data('debug') !== undefined && $(media).data('debug') !== "false") { |
106 | | - this.debug = true; |
| 105 | + if ($(media).data('youtube-desc-id') !== undefined && $(media).data('youtube-desc-id') !== "") { |
| 106 | + this.youtubeDescId = $(media).data('youtube-desc-id'); |
107 | 107 | } |
108 | 108 |
|
109 | | - if ($(media).data('youtube-id') !== undefined && $(media).data('youtube-id') !== "") { |
110 | | - // move this to <source> element |
111 | | - this.youtubeId = $(media).data('youtube-id'); |
| 109 | + if ($(media).data('debug') !== undefined && $(media).data('debug') !== "false") { |
| 110 | + this.debug = true; |
112 | 111 | } |
113 | 112 |
|
114 | 113 | if ($(media).data('volume') !== undefined && $(media).data('volume') !== "") { |
|
715 | 714 | var containerId = thisObj.mediaId + '_youtube'; |
716 | 715 | thisObj.$mediaContainer.prepend($('<div>').attr('id', containerId)); |
717 | 716 |
|
| 717 | + var youTubeId; |
| 718 | + // if a described version is available && user prefers desription |
| 719 | + // give them the described version |
| 720 | + if (thisObj.youtubeDescId && thisObj.prefDesc) { |
| 721 | + youTubeId = thisObj.youtubeDescId; |
| 722 | + // TODO: add alert informing the user that the described version is being loaded |
| 723 | + } |
| 724 | + else { |
| 725 | + youTubeId = thisObj.youtubeId; |
| 726 | + } |
| 727 | + |
718 | 728 | thisObj.youtubePlayer = new YT.Player(containerId, { |
719 | | - videoId: thisObj.youtubeId, |
| 729 | + videoId: youTubeId, |
720 | 730 | height: thisObj.playerHeight.toString(), |
721 | 731 | width: thisObj.playerWidth.toString(), |
722 | 732 | playerVars: { |
|
1907 | 1917 |
|
1908 | 1918 | this.injectOffscreenHeading(); |
1909 | 1919 |
|
1910 | | - if (this.mediaType === 'video') { |
| 1920 | + // youtube adds its own big play button |
| 1921 | + if (this.mediaType === 'video' && this.player !== 'youtube') { |
1911 | 1922 | this.injectBigPlayButton(); |
1912 | 1923 |
|
1913 | 1924 | // add container that captions or description will be appended to |
@@ -4131,6 +4142,10 @@ console.log('number of matching parent elements: ' + prevHeading.length); |
4131 | 4142 | } |
4132 | 4143 | else if (this.player === 'youtube') { |
4133 | 4144 | // Youtube always supports a finite list of playback rates. Only expose controls if more than one is available. |
| 4145 | +console.log('how many playbackrates are supported?'); |
| 4146 | +var ytrates = this.youtubePlayer.getAvailablePlaybackRates(); |
| 4147 | +console.log(ytrates.length + '. They are: '); |
| 4148 | +console.log(ytrates); |
4134 | 4149 | return (this.youtubePlayer.getAvailablePlaybackRates().length > 1); |
4135 | 4150 | } |
4136 | 4151 | }; |
@@ -4548,6 +4563,8 @@ console.log('fast forwarding ' + this.seekInterval + ' seconds'); |
4548 | 4563 | } |
4549 | 4564 | else if (this.player === 'youtube') { |
4550 | 4565 | var rates = this.youtubePlayer.getAvailablePlaybackRates(); |
| 4566 | +console.log('available playback rates:'); |
| 4567 | +console.log(rates); |
4551 | 4568 | var currentRate = this.getPlaybackRate(); |
4552 | 4569 | var index = rates.indexOf(currentRate); |
4553 | 4570 | if (index === -1) { |
|
0 commit comments