| 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 /** | 5 /** |
| 6 * @param {!HTMLElement} playerContainer Main container. | 6 * @param {!HTMLElement} playerContainer Main container. |
| 7 * @param {!HTMLElement} videoContainer Container for the video element. | 7 * @param {!HTMLElement} videoContainer Container for the video element. |
| 8 * @param {!HTMLElement} controlsContainer Container for video controls. | 8 * @param {!HTMLElement} controlsContainer Container for video controls. |
| 9 * @constructor | 9 * @constructor |
| 10 * @struct | 10 * @struct |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 | 416 |
| 417 this.videoElement_.addEventListener('play', function() { | 417 this.videoElement_.addEventListener('play', function() { |
| 418 chrome.power.requestKeepAwake('display'); | 418 chrome.power.requestKeepAwake('display'); |
| 419 this.updateInactivityWatcherState_(); | 419 this.updateInactivityWatcherState_(); |
| 420 }.wrap(this)); | 420 }.wrap(this)); |
| 421 this.videoElement_.addEventListener('pause', function() { | 421 this.videoElement_.addEventListener('pause', function() { |
| 422 chrome.power.releaseKeepAwake(); | 422 chrome.power.releaseKeepAwake(); |
| 423 this.updateInactivityWatcherState_(); | 423 this.updateInactivityWatcherState_(); |
| 424 }.wrap(this)); | 424 }.wrap(this)); |
| 425 this.controls.attachMedia(this.videoElement_); | 425 this.controls.attachMedia(this.videoElement_); |
| 426 // TODO(ryoh): | 426 this.videoElement_.load(); |
| 427 // If you modify the video element that is already inserted, | |
| 428 // you have to call load() method. | |
| 429 // https://dev.w3.org/html5/spec-author-view/video.html | |
| 430 // But we always create new video element (see above), | |
| 431 // we don't have to call load(). | |
| 432 // If you call load() method here, | |
| 433 // you can't see subtitles. | |
| 434 // (It might be a bug: https://crbug.com/594537) | |
| 435 //this.videoElement_.load(); | |
| 436 callback(); | 427 callback(); |
| 437 }.bind(this)) | 428 }.bind(this)) |
| 438 // In case of error. | 429 // In case of error. |
| 439 .catch(function(error) { | 430 .catch(function(error) { |
| 440 if (this.currentCast_) | 431 if (this.currentCast_) |
| 441 metrics.recordCastVideoErrorAction(); | 432 metrics.recordCastVideoErrorAction(); |
| 442 | 433 |
| 443 videoPlayerElement.removeAttribute('loading'); | 434 videoPlayerElement.removeAttribute('loading'); |
| 444 console.error('Failed to initialize the video element.', | 435 console.error('Failed to initialize the video element.', |
| 445 error.stack || error); | 436 error.stack || error); |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 return new Promise(function(fulfill, reject) { | 732 return new Promise(function(fulfill, reject) { |
| 742 util.URLsToEntries(window.appState.items, function(entries) { | 733 util.URLsToEntries(window.appState.items, function(entries) { |
| 743 metrics.recordOpenVideoPlayerAction(); | 734 metrics.recordOpenVideoPlayerAction(); |
| 744 metrics.recordNumberOfOpenedFiles(entries.length); | 735 metrics.recordNumberOfOpenedFiles(entries.length); |
| 745 | 736 |
| 746 player.prepare(entries); | 737 player.prepare(entries); |
| 747 player.playFirstVideo(player, fulfill); | 738 player.playFirstVideo(player, fulfill); |
| 748 }.wrap()); | 739 }.wrap()); |
| 749 }.wrap()); | 740 }.wrap()); |
| 750 }.wrap()); | 741 }.wrap()); |
| OLD | NEW |