diff options
author | yoshiki <yoshiki@chromium.org> | 2014-09-17 22:20:09 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-18 05:20:22 +0000 |
commit | c1165114767914b846c21f0a3f012d7ded0d96dd (patch) | |
tree | 3bd5126254b37d6c20e890be44a55576df788478 /ui | |
parent | 0d95894f4e846d7352d9813cd34f43efdb6e1e4e (diff) | |
download | chromium_src-c1165114767914b846c21f0a3f012d7ded0d96dd.zip chromium_src-c1165114767914b846c21f0a3f012d7ded0d96dd.tar.gz chromium_src-c1165114767914b846c21f0a3f012d7ded0d96dd.tar.bz2 |
Video Player: Show the status icon on display when the status is changed
This patch adds a feature to show the icon. See the issue for the detail.
BUG=412978
TEST=manually tested
Review URL: https://codereview.chromium.org/578823002
Cr-Commit-Position: refs/heads/master@{#295418}
Diffstat (limited to 'ui')
-rw-r--r-- | ui/file_manager/video_player/js/cast/cast_video_element.js | 31 | ||||
-rw-r--r-- | ui/file_manager/video_player/js/media_controls.js | 4 |
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()); } |