|
3483 | 3483 | trackLabel.text(this.flattenCueForCaption(track) + ' - ' + this.formatSecondsAsColonTime(track.start)); |
3484 | 3484 | var getClickFunction = function (time) { |
3485 | 3485 | return function () { |
| 3486 | + thisObj.seekTrigger = 'chapter'; |
3486 | 3487 | thisObj.seekTo(time); |
3487 | 3488 | // stopgap to prevent spacebar in Firefox from reopening popup |
3488 | 3489 | // immediately after closing it (used in handleChapters()) |
@@ -8741,6 +8742,7 @@ console.log('resizeYouTubePlayer at POS Y1'); |
8741 | 8742 | // add event listeners |
8742 | 8743 | getClickFunction = function (time) { |
8743 | 8744 | return function () { |
| 8745 | + thisObj.seekTrigger = 'chapter'; |
8744 | 8746 | $clickedItem = $(this).closest('li'); |
8745 | 8747 | $chaptersList = $(this).closest('ul').find('li'); |
8746 | 8748 | thisChapterIndex = $chaptersList.index($clickedItem); |
@@ -9254,13 +9256,14 @@ console.log('resizeYouTubePlayer at POS Y1'); |
9254 | 9256 | // Keydown events are handled elsehwere, both globally (ableplayer-base.js) and locally (event.js) |
9255 | 9257 | if (this.$transcriptArea.length > 0) { |
9256 | 9258 | this.$transcriptArea.find('span.able-transcript-seekpoint').click(function(event) { |
| 9259 | + thisObj.seekTrigger = 'transcript'; |
9257 | 9260 | var spanStart = parseFloat($(this).attr('data-start')); |
9258 | 9261 | // Add a tiny amount so that we're inside the span. |
9259 | 9262 | spanStart += .01; |
9260 | 9263 | // Each click within the transcript triggers two click events (not sure why) |
9261 | 9264 | // this.seekingFromTranscript is a stopgab to prevent two calls to SeekTo() |
9262 | | - if (!this.seekingFromTranscript) { |
9263 | | - this.seekingFromTranscript = true; |
| 9265 | + if (!thisObj.seekingFromTranscript) { |
| 9266 | + thisObj.seekingFromTranscript = true; |
9264 | 9267 | thisObj.seekTo(spanStart); |
9265 | 9268 | } |
9266 | 9269 | else { |
@@ -9984,12 +9987,15 @@ console.log('resizeYouTubePlayer at POS Y1'); |
9984 | 9987 | this.handlePlay(); |
9985 | 9988 | } |
9986 | 9989 | else if (whichButton === 'restart') { |
| 9990 | + this.seekTrigger = 'restart'; |
9987 | 9991 | this.handleRestart(); |
9988 | 9992 | } |
9989 | 9993 | else if (whichButton === 'rewind') { |
| 9994 | + this.seekTrigger = 'rewind'; |
9990 | 9995 | this.handleRewind(); |
9991 | 9996 | } |
9992 | 9997 | else if (whichButton === 'forward') { |
| 9998 | + this.seekTrigger = 'forward'; |
9993 | 9999 | this.handleFastForward(); |
9994 | 10000 | } |
9995 | 10001 | else if (whichButton === 'mute') { |
@@ -10154,7 +10160,13 @@ console.log('resizeYouTubePlayer at POS Y1'); |
10154 | 10160 | // so we know player can seek ahead to anything |
10155 | 10161 | }) |
10156 | 10162 | .on('canplaythrough',function() { |
10157 | | - if (!thisObj.startedPlaying) { |
| 10163 | + if (thisObj.seekTrigger == 'restart' || thisObj.seekTrigger == 'chapter' || thisObj.seekTrigger == 'transcript') { |
| 10164 | + // by clicking on any of these elements, user is likely intending to play |
| 10165 | + // Not included: elements where user might click multiple times in succession |
| 10166 | + // (i.e., 'rewind', 'forward', or seekbar); for these, video remains paused until user initiates play |
| 10167 | + thisObj.playMedia(); |
| 10168 | + } |
| 10169 | + else if (!thisObj.startedPlaying) { |
10158 | 10170 | if (thisObj.startTime) { |
10159 | 10171 | if (thisObj.seeking) { |
10160 | 10172 | // a seek has already been initiated |
|
0 commit comments