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

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

Issue 611243003: Rename the VideoPlayer-related string IDs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years, 2 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
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 * @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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 * Handles playback (decoder) errors. 105 * Handles playback (decoder) errors.
106 * @param {MediaError} error Error object. 106 * @param {MediaError} error Error object.
107 * @private 107 * @private
108 */ 108 */
109 FullWindowVideoControls.prototype.onPlaybackError_ = function(error) { 109 FullWindowVideoControls.prototype.onPlaybackError_ = function(error) {
110 if (error.target && error.target.error && 110 if (error.target && error.target.error &&
111 error.target.error.code === MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED) { 111 error.target.error.code === MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED) {
112 if (this.casting) 112 if (this.casting)
113 this.showErrorMessage('VIDEO_PLAYER_VIDEO_FILE_UNSUPPORTED_FOR_CAST'); 113 this.showErrorMessage('VIDEO_PLAYER_VIDEO_FILE_UNSUPPORTED_FOR_CAST');
114 else 114 else
115 this.showErrorMessage('GALLERY_VIDEO_ERROR'); 115 this.showErrorMessage('VIDEO_PLAYER_VIDEO_FILE_UNSUPPORTED');
116 this.decodeErrorOccured = false; 116 this.decodeErrorOccured = false;
117 } else { 117 } else {
118 this.showErrorMessage('GALLERY_VIDEO_DECODING_ERROR'); 118 this.showErrorMessage('VIDEO_PLAYER_PLAYBACK_ERROR');
119 this.decodeErrorOccured = true; 119 this.decodeErrorOccured = true;
120 } 120 }
121 121
122 // Disable inactivity watcher, and disable the ui, by hiding tools manually. 122 // Disable inactivity watcher, and disable the ui, by hiding tools manually.
123 this.inactivityWatcher.disabled = true; 123 this.inactivityWatcher.disabled = true;
124 document.querySelector('#video-player').setAttribute('disabled', 'true'); 124 document.querySelector('#video-player').setAttribute('disabled', 'true');
125 125
126 // Detach the video element, since it may be unreliable and reset stored 126 // Detach the video element, since it may be unreliable and reset stored
127 // current playback time. 127 // current playback time.
128 this.cleanup(); 128 this.cleanup();
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 }.wrap()); 399 }.wrap());
400 400
401 this.videoElement_.load(); 401 this.videoElement_.load();
402 callback(); 402 callback();
403 }.bind(this)). 403 }.bind(this)).
404 // In case of error. 404 // In case of error.
405 catch(function(error) { 405 catch(function(error) {
406 videoPlayerElement.removeAttribute('loading'); 406 videoPlayerElement.removeAttribute('loading');
407 console.error('Failed to initialize the video element.', 407 console.error('Failed to initialize the video element.',
408 error.stack || error); 408 error.stack || error);
409 this.controls_.showErrorMessage('GALLERY_VIDEO_ERROR'); 409 this.controls_.showErrorMessage(
410 'VIDEO_PLAYER_VIDEO_FILE_UNSUPPORTED');
410 callback(); 411 callback();
411 }.bind(this)); 412 }.bind(this));
412 }.wrap(this)); 413 }.wrap(this));
413 }; 414 };
414 415
415 /** 416 /**
416 * Plays the first video. 417 * Plays the first video.
417 */ 418 */
418 VideoPlayer.prototype.playFirstVideo = function() { 419 VideoPlayer.prototype.playFirstVideo = function() {
419 this.currentPos_ = 0; 420 this.currentPos_ = 0;
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 /** 612 /**
612 * Called when the current cast is disappear from the cast list. 613 * Called when the current cast is disappear from the cast list.
613 * @private 614 * @private
614 */ 615 */
615 VideoPlayer.prototype.onCurrentCastDisappear_ = function() { 616 VideoPlayer.prototype.onCurrentCastDisappear_ = function() {
616 this.currentCast_ = null; 617 this.currentCast_ = null;
617 if (this.currentSession_) { 618 if (this.currentSession_) {
618 this.currentSession_.removeUpdateListener(this.onCastSessionUpdateBound_); 619 this.currentSession_.removeUpdateListener(this.onCastSessionUpdateBound_);
619 this.currentSession_ = null; 620 this.currentSession_ = null;
620 } 621 }
621 this.controls.showErrorMessage('GALLERY_VIDEO_DECODING_ERROR'); 622 this.controls.showErrorMessage('VIDEO_PLAYER_PLAYBACK_ERROR');
622 this.unloadVideo(); 623 this.unloadVideo();
623 }; 624 };
624 625
625 /** 626 /**
626 * This method should be called when the session is updated. 627 * This method should be called when the session is updated.
627 * @param {boolean} alive Whether the session is alive or not. 628 * @param {boolean} alive Whether the session is alive or not.
628 * @private 629 * @private
629 */ 630 */
630 VideoPlayer.prototype.onCastSessionUpdate_ = function(alive) { 631 VideoPlayer.prototype.onCastSessionUpdate_ = function(alive) {
631 if (!alive) 632 if (!alive)
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 var initPromise = Promise.all( 670 var initPromise = Promise.all(
670 [new Promise(initVideos.wrap(null)), 671 [new Promise(initVideos.wrap(null)),
671 new Promise(initStrings.wrap(null)), 672 new Promise(initStrings.wrap(null)),
672 new Promise(util.addPageLoadHandler.wrap(null))]); 673 new Promise(util.addPageLoadHandler.wrap(null))]);
673 674
674 initPromise.then(function(results) { 675 initPromise.then(function(results) {
675 var videos = results[0]; 676 var videos = results[0];
676 player.prepare(videos); 677 player.prepare(videos);
677 return new Promise(player.playFirstVideo.wrap(player)); 678 return new Promise(player.playFirstVideo.wrap(player));
678 }.wrap(null)); 679 }.wrap(null));
OLDNEW
« chrome/app/chromeos_strings.grdp ('K') | « ui/file_manager/video_player/js/media_controls.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698