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

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

Issue 506583002: Video Player: Support seek on casting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed the comment Created 6 years, 3 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 if (this.castMedia_) { 84 if (this.castMedia_) {
85 if (this.castMedia_.idleReason === chrome.cast.media.IdleReason.FINISHED) 85 if (this.castMedia_.idleReason === chrome.cast.media.IdleReason.FINISHED)
86 return this.currentMediaDuration_; // Returns the duration. 86 return this.currentMediaDuration_; // Returns the duration.
87 else 87 else
88 return this.castMedia_.getEstimatedTime(); 88 return this.castMedia_.getEstimatedTime();
89 } else { 89 } else {
90 return null; 90 return null;
91 } 91 }
92 }, 92 },
93 set currentTime(currentTime) { 93 set currentTime(currentTime) {
94 // TODO(yoshiki): Support seek. 94 var seekRequest = new chrome.cast.media.SeekRequest();
95 seekRequest.currentTime = currentTime;
96 this.castMedia_.seek(seekRequest,
97 function() {},
98 this.onCastCommandError_.wrap(this));
95 }, 99 },
96 100
97 /** 101 /**
98 * If this video is pauses or not. 102 * If this video is pauses or not.
99 * @type {boolean} 103 * @type {boolean}
100 */ 104 */
101 get paused() { 105 get paused() {
102 if (!this.castMedia_) 106 if (!this.castMedia_)
103 return false; 107 return false;
104 108
105 return !this.playInProgress_ && 109 return !this.playInProgress_ &&
106 (this.pauseInProgress_ || 110 (this.pauseInProgress_ ||
107 this.castMedia_.playerState === chrome.cast.media.PlayerState.PAUSED); 111 this.castMedia_.playerState === chrome.cast.media.PlayerState.PAUSED);
108 }, 112 },
109 113
110 /** 114 /**
111 * If this video is ended or not. 115 * If this video is ended or not.
112 * @type {boolean} 116 * @type {boolean}
113 */ 117 */
114 get ended() { 118 get ended() {
115 if (!this.castMedia_) 119 if (!this.castMedia_)
116 return true; 120 return true;
117 121
118 return this.castMedia_.idleReason === chrome.cast.media.IdleReason.FINISHED; 122 return this.castMedia_.idleReason === chrome.cast.media.IdleReason.FINISHED;
119 }, 123 },
120 124
121 /** 125 /**
122 * If this video is seekable or not. 126 * TimeRange object that represents the seekable ranges of the media
123 * @type {boolean} 127 * resource.
128 * @type {TimeRanges}
124 */ 129 */
125 get seekable() { 130 get seekable() {
126 // TODO(yoshiki): Support seek. 131 return {
127 return false; 132 length: 1,
133 start: function(index) { return 0; },
134 end: function(index) { return this.currentMediaDuration_; },
135 };
128 }, 136 },
129 137
130 /** 138 /**
131 * Value of the volume 139 * Value of the volume
132 * @type {number} 140 * @type {number}
133 */ 141 */
134 get volume() { 142 get volume() {
135 return this.castSession_.receiver.volume.muted ? 143 return this.castSession_.receiver.volume.muted ?
136 0 : 144 0 :
137 this.castSession_.receiver.volume.level; 145 this.castSession_.receiver.volume.level;
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 this.dispatchEvent(new Event('durationchange')); 415 this.dispatchEvent(new Event('durationchange'));
408 } 416 }
409 417
410 // Media is being unloaded. 418 // Media is being unloaded.
411 if (!alive) { 419 if (!alive) {
412 this.unloadMedia_(); 420 this.unloadMedia_();
413 return; 421 return;
414 } 422 }
415 }, 423 },
416 }; 424 };
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