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

Unified Diff: ui/file_manager/video_player/js/cast/cast_video_element.js

Issue 439223003: Video Player: Fix minor error handling bugs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed the comment Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/video_player/js/cast/cast_video_element.js
diff --git a/ui/file_manager/video_player/js/cast/cast_video_element.js b/ui/file_manager/video_player/js/cast/cast_video_element.js
index 04aa82da26dff7d1e53f3b363ff160461e8033b9..cf53f3228f0db49768a6003b7c425d8dd3bb09fc 100644
--- a/ui/file_manager/video_player/js/cast/cast_video_element.js
+++ b/ui/file_manager/video_player/js/cast/cast_video_element.js
@@ -186,12 +186,12 @@ CastVideoElement.prototype = {
play: function() {
var play = function() {
this.castMedia_.play(null,
- function () {
+ function() {
this.playInProgress_ = false;
}.wrap(this),
- function () {
+ function(error) {
this.playInProgress_ = false;
- this.onCastCommandError_();
+ this.onCastCommandError_(error);
}.wrap(this));
}.wrap(this);
@@ -212,12 +212,12 @@ CastVideoElement.prototype = {
this.pauseInProgress_ = true;
this.castMedia_.pause(null,
- function () {
+ function() {
this.pauseInProgress_ = false;
}.wrap(this),
- function () {
+ function(error) {
this.pauseInProgress_ = false;
- this.onCastCommandError_();
+ this.onCastCommandError_(error);
}.wrap(this));
},
@@ -256,8 +256,10 @@ CastVideoElement.prototype = {
opt_callback();
}.bind(this));
}.bind(this)).catch(function(error) {
+ this.unloadMedia_();
+ this.dispatchEvent(new Event('error'));
console.error('Cast failed.', error.stack || error);
- });
+ }.bind(this));
},
/**
@@ -267,8 +269,8 @@ CastVideoElement.prototype = {
unloadMedia_: function() {
if (this.castMedia_) {
this.castMedia_.stop(null,
- function () {},
- function () {
+ function() {},
+ function(error) {
// Ignores session error, since session may already be closed.
if (error.code !== chrome.cast.ErrorCode.SESSION_ERROR)
this.onCastCommandError_(error);
@@ -354,11 +356,13 @@ CastVideoElement.prototype = {
/**
* This method should be called when a media command to cast is failed.
+ * @param {Object} error Object representing the error.
* @private
*/
- onCastCommandError_: function() {
+ onCastCommandError_: function(error) {
this.unloadMedia_();
this.dispatchEvent(new Event('error'));
+ console.error('Error on sending command to cast.', error.stack || error);
},
/**
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698