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 * @param {Element} playerContainer Main container. | 8 * @param {Element} playerContainer Main container. |
9 * @param {Element} videoContainer Container for the video element. | 9 * @param {Element} videoContainer Container for the video element. |
10 * @param {Element} controlsContainer Container for video controls. | 10 * @param {Element} controlsContainer Container for video controls. |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 /** | 98 /** |
99 * Toggles the full screen mode. | 99 * Toggles the full screen mode. |
100 * @private | 100 * @private |
101 */ | 101 */ |
102 FullWindowVideoControls.prototype.toggleFullScreen_ = function() { | 102 FullWindowVideoControls.prototype.toggleFullScreen_ = function() { |
103 var appWindow = chrome.app.window.current(); | 103 var appWindow = chrome.app.window.current(); |
104 util.toggleFullScreen(appWindow, !util.isFullScreen(appWindow)); | 104 util.toggleFullScreen(appWindow, !util.isFullScreen(appWindow)); |
105 }; | 105 }; |
106 | 106 |
107 /** | 107 /** |
| 108 * Media completion handler. |
| 109 */ |
| 110 FullWindowVideoControls.prototype.onMediaComplete = function() { |
| 111 VideoControls.prototype.onMediaComplete.apply(this, arguments); |
| 112 if (!this.getMedia().loop) |
| 113 player.advance_(1); |
| 114 }; |
| 115 |
| 116 /** |
108 * @constructor | 117 * @constructor |
109 */ | 118 */ |
110 function VideoPlayer() { | 119 function VideoPlayer() { |
111 this.controls_ = null; | 120 this.controls_ = null; |
112 this.videoElement_ = null; | 121 this.videoElement_ = null; |
113 this.videos_ = null; | 122 this.videos_ = null; |
114 this.currentPos_ = 0; | 123 this.currentPos_ = 0; |
115 | 124 |
116 Object.seal(this); | 125 Object.seal(this); |
117 } | 126 } |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 var initPromise = Promise.all( | 425 var initPromise = Promise.all( |
417 [new Promise(initVideos.wrap(null)), | 426 [new Promise(initVideos.wrap(null)), |
418 new Promise(initStrings.wrap(null)), | 427 new Promise(initStrings.wrap(null)), |
419 new Promise(util.addPageLoadHandler.wrap(null))]); | 428 new Promise(util.addPageLoadHandler.wrap(null))]); |
420 | 429 |
421 initPromise.then(function(results) { | 430 initPromise.then(function(results) { |
422 var videos = results[0]; | 431 var videos = results[0]; |
423 player.prepare(videos); | 432 player.prepare(videos); |
424 return new Promise(player.playFirstVideo.wrap(player)); | 433 return new Promise(player.playFirstVideo.wrap(player)); |
425 }.wrap(null)); | 434 }.wrap(null)); |
OLD | NEW |