summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/file_manager/video_player/js/cast/cast_video_element.js31
-rw-r--r--ui/file_manager/video_player/js/media_controls.js4
2 files changed, 29 insertions, 6 deletions
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 fd3f4b6..6e0708c 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),
diff --git a/ui/file_manager/video_player/js/media_controls.js b/ui/file_manager/video_player/js/media_controls.js
index b769430..3a523ea 100644
--- a/ui/file_manager/video_player/js/media_controls.js
+++ b/ui/file_manager/video_player/js/media_controls.js
@@ -261,13 +261,13 @@ MediaControls.prototype.onProgressDrag_ = function(on) {
if (on) {
this.resumeAfterDrag_ = this.isPlaying();
- this.media_.pause();
+ this.media_.pause(true /* seeking */);
} else {
if (this.resumeAfterDrag_) {
if (this.media_.ended)
this.onMediaPlay_(false);
else
- this.media_.play();
+ this.media_.play(true /* seeking */);
}
this.updatePlayButtonState_(this.isPlaying());
}