OLD | NEW |
---|---|
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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
83 get currentTime() { | 83 get currentTime() { |
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) { |
fukino
2014/08/26 03:45:06
nit: Please provide a JSDoc comment.
yoshiki
2014/08/26 04:25:23
This is a setter so we don't need JSDoc.
| |
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 objects that represents the seekable ranges of the media |
fukino
2014/08/26 03:45:06
super nit: s/TimeRange objects/TimeRanges object/
yoshiki
2014/08/26 04:25:39
Done.
| |
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 Loading... | |
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 }; |
OLD | NEW |