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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 errorBanner.textContent = | 94 errorBanner.textContent = |
95 loadTimeData.getString(message); | 95 loadTimeData.getString(message); |
96 errorBanner.setAttribute('visible', 'true'); | 96 errorBanner.setAttribute('visible', 'true'); |
97 | 97 |
98 // The window is hidden if the video has not loaded yet. | 98 // The window is hidden if the video has not loaded yet. |
99 chrome.app.window.current().show(); | 99 chrome.app.window.current().show(); |
100 }; | 100 }; |
101 | 101 |
102 /** | 102 /** |
103 * Handles playback (decoder) errors. | 103 * Handles playback (decoder) errors. |
| 104 * @param {MediaError} error Error object. |
104 * @private | 105 * @private |
105 */ | 106 */ |
106 FullWindowVideoControls.prototype.onPlaybackError_ = function() { | 107 FullWindowVideoControls.prototype.onPlaybackError_ = function(error) { |
107 this.showErrorMessage('GALLERY_VIDEO_DECODING_ERROR'); | 108 if (error.target && |
108 this.decodeErrorOccured = true; | 109 error.target.error.code === MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED) { |
| 110 this.showErrorMessage('GALLERY_VIDEO_ERROR'); |
| 111 this.decodeErrorOccured = false; |
| 112 } else { |
| 113 this.showErrorMessage('GALLERY_VIDEO_DECODING_ERROR'); |
| 114 this.decodeErrorOccured = true; |
| 115 } |
109 | 116 |
110 // Disable inactivity watcher, and disable the ui, by hiding tools manually. | 117 // Disable inactivity watcher, and disable the ui, by hiding tools manually. |
111 this.inactivityWatcher.disabled = true; | 118 this.inactivityWatcher.disabled = true; |
112 document.querySelector('#video-player').setAttribute('disabled', 'true'); | 119 document.querySelector('#video-player').setAttribute('disabled', 'true'); |
113 | 120 |
114 // Detach the video element, since it may be unreliable and reset stored | 121 // Detach the video element, since it may be unreliable and reset stored |
115 // current playback time. | 122 // current playback time. |
116 this.cleanup(); | 123 this.cleanup(); |
117 this.clearState(); | 124 this.clearState(); |
118 | 125 |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 var initPromise = Promise.all( | 621 var initPromise = Promise.all( |
615 [new Promise(initVideos.wrap(null)), | 622 [new Promise(initVideos.wrap(null)), |
616 new Promise(initStrings.wrap(null)), | 623 new Promise(initStrings.wrap(null)), |
617 new Promise(util.addPageLoadHandler.wrap(null))]); | 624 new Promise(util.addPageLoadHandler.wrap(null))]); |
618 | 625 |
619 initPromise.then(function(results) { | 626 initPromise.then(function(results) { |
620 var videos = results[0]; | 627 var videos = results[0]; |
621 player.prepare(videos); | 628 player.prepare(videos); |
622 return new Promise(player.playFirstVideo.wrap(player)); | 629 return new Promise(player.playFirstVideo.wrap(player)); |
623 }.wrap(null)); | 630 }.wrap(null)); |
OLD | NEW |