Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: ui/file_manager/video_player/js/cast/cast_video_element.js

Issue 603413003: Correct condition and flag state for skipping PLAY request. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 'use strict'; 5 'use strict';
6 6
7 /** 7 /**
8 * Interval for updating media info (in ms). 8 * Interval for updating media info (in ms).
9 * @type {number} 9 * @type {number}
10 * @const 10 * @const
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 217
218 /** 218 /**
219 * Plays the video. 219 * Plays the video.
220 * @param {boolean=} opt_seeking True when seeking. False otherwise. 220 * @param {boolean=} opt_seeking True when seeking. False otherwise.
221 */ 221 */
222 play: function(opt_seeking) { 222 play: function(opt_seeking) {
223 if (this.playInProgress_) 223 if (this.playInProgress_)
224 return; 224 return;
225 225
226 var play = function() { 226 var play = function() {
227 // If the casted media is already playing and a pause request is not in
228 // progress, we can skip this play request.
227 if (this.castMedia_.playerState === 229 if (this.castMedia_.playerState ===
228 chrome.cast.media.PlayerState.PLAYING) { 230 chrome.cast.media.PlayerState.PLAYING &&
231 !this.pauseInProgress_) {
232 this.playInProgress_ = false;
229 return; 233 return;
230 } 234 }
231 235
232 var playRequest = new chrome.cast.media.PlayRequest(); 236 var playRequest = new chrome.cast.media.PlayRequest();
233 playRequest.customData = {seeking: !!opt_seeking}; 237 playRequest.customData = {seeking: !!opt_seeking};
234 238
235 this.castMedia_.play( 239 this.castMedia_.play(
236 playRequest, 240 playRequest,
237 function() { 241 function() {
238 this.playInProgress_ = false; 242 this.playInProgress_ = false;
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 this.dispatchEvent(new Event('durationchange')); 492 this.dispatchEvent(new Event('durationchange'));
489 } 493 }
490 494
491 // Media is being unloaded. 495 // Media is being unloaded.
492 if (!alive) { 496 if (!alive) {
493 this.unloadMedia_(); 497 this.unloadMedia_();
494 return; 498 return;
495 } 499 }
496 }, 500 },
497 }; 501 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698