(function ($) { AblePlayer.prototype.injectTranscriptArea = function() { var thisObj = this; this.$transcriptArea = $('
', { 'class': 'able-transcript-area', 'tabindex': '-1' }); this.$transcriptToolbar = $('
', { 'class': 'able-window-toolbar able-' + this.toolbarIconColor + '-controls' }); this.$transcriptDiv = $('
', { 'class' : 'able-transcript' }); // Transcript toolbar content: this.$autoScrollTranscriptCheckbox = $(''); this.$transcriptToolbar.append($(''), this.$autoScrollTranscriptCheckbox); // Add field for selecting a transcript language // This will be deleted in initialize.js > recreatePlayer() if there are no languages this.$transcriptLanguageSelect = $(''); this.$transcriptToolbar.append($(''), this.$autoScrollTranscriptCheckbox); }; AblePlayer.prototype.updateTranscript = function() { if (!this.transcriptType) { return; } if (this.transcriptType === 'external' || this.transcriptType === 'popup') { var chapters, captions, descriptions; // Language of transcript might be different than language of captions // But both are in sync by default if (this.transcriptLang) { captions = this.transcriptCaptions.cues; } else { if (this.transcriptCaptions) { this.transcriptLang = this.transcriptCaptions.language; captions = this.transcriptCaptions.cues; } else if (this.selectedCaptions) { this.transcriptLang = this.captionLang; captions = this.selectedCaptions.cues; } } // setup chapters if (this.transcriptChapters) { chapters = this.transcriptChapters.cues; } else if (this.chapters.length > 0) { // Try and match the caption language. if (this.transcriptLang) { for (var ii = 0; ii < this.chapters.length; ii++) { if (this.chapters[ii].language === this.transcriptLang) { chapters = this.chapters[ii].cues; } } } if (typeof chapters === 'undefined') { chapters = this.chapters[0].cues || []; } } // setup descriptions if (this.transcriptDescriptions) { descriptions = this.transcriptDescriptions.cues; } else if (this.descriptions.length > 0) { // Try and match the caption language. if (this.transcriptLang) { for (var ii = 0; ii < this.descriptions.length; ii++) { if (this.descriptions[ii].language === this.transcriptLang) { descriptions = this.descriptions[ii].cues; } } } if (!descriptions) { descriptions = this.descriptions[0].cues || []; } } var div = this.generateTranscript(chapters || [], captions || [], descriptions || []); this.$transcriptDiv.html(div); // reset transcript selected