Index: ui/file_manager/video_player/js/cast/cast_video_element.js |
diff --git a/ui/file_manager/video_player/js/cast/cast_video_element.js b/ui/file_manager/video_player/js/cast/cast_video_element.js |
index ccbc342f5dbb6f133fe92d3e5dff1b3d881ffd3e..e3ca6e5599f30346b3a269dd729f200d06abf06f 100644 |
--- a/ui/file_manager/video_player/js/cast/cast_video_element.js |
+++ b/ui/file_manager/video_player/js/cast/cast_video_element.js |
@@ -217,10 +217,23 @@ CastVideoElement.prototype = { |
/** |
* Plays the video. |
+ * @param {boolean=} opt_seeking True when seeking. False otherwise. |
*/ |
- play: function() { |
+ play: function(opt_seeking) { |
+ if (this.playInProgress_) |
+ return; |
+ |
var play = function() { |
- this.castMedia_.play(null, |
+ if (this.castMedia_.playerState === |
+ chrome.cast.media.PlayerState.PLAYING) { |
+ return; |
+ } |
+ |
+ var playRequest = new chrome.cast.media.PlayRequest(); |
+ playRequest.customData = {seeking: !!opt_seeking}; |
+ |
+ this.castMedia_.play( |
+ playRequest, |
function() { |
this.playInProgress_ = false; |
}.wrap(this), |
@@ -240,13 +253,23 @@ CastVideoElement.prototype = { |
/** |
* Pauses the video. |
+ * @param {boolean=} opt_seeking True when seeking. False otherwise. |
*/ |
- pause: function() { |
+ pause: function(opt_seeking) { |
if (!this.castMedia_) |
return; |
+ if (this.pauseInProgress_ || |
+ this.castMedia_.playerState === chrome.cast.media.PlayerState.PAUSED) { |
+ return; |
+ } |
+ |
+ var pauseRequest = new chrome.cast.media.PauseRequest(); |
+ pauseRequest.customData = {seeking: !!opt_seeking}; |
+ |
this.pauseInProgress_ = true; |
- this.castMedia_.pause(null, |
+ this.castMedia_.pause( |
+ pauseRequest, |
function() { |
this.pauseInProgress_ = false; |
}.wrap(this), |