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 f436c9a0a0febe3d33aa01af3f8ac2b802262aec..196f840ec5444571a29519fd8d7e534af44e7d08 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 |
@@ -41,6 +41,7 @@ function CastVideoElement(media, session) { |
this.currentMediaDuration_ = null; |
this.playInProgress_ = false; |
this.pauseInProgress_ = false; |
+ this.errorCode_ = 0; |
this.onMessageBound_ = this.onMessage_.bind(this); |
this.onCastMediaUpdatedBound_ = this.onCastMediaUpdated_.bind(this); |
@@ -189,6 +190,17 @@ CastVideoElement.prototype = { |
}, |
/** |
+ * Returns the error object if available. |
+ * @type {?Object} |
+ */ |
+ get error() { |
+ if (this.errorCode_ === 0) |
+ return null; |
+ |
+ return {code: this.errorCode_}; |
+ }, |
+ |
+ /** |
* Plays the video. |
*/ |
play: function() { |
@@ -238,6 +250,9 @@ CastVideoElement.prototype = { |
this.sendMessage_({message: 'push-token', token: token}); |
}.bind(this)); |
+ // Resets the error code. |
+ this.errorCode_ = 0; |
+ |
Promise.all([ |
sendTokenPromise, |
this.mediaManager_.getUrl(), |
@@ -287,6 +302,7 @@ CastVideoElement.prototype = { |
this.castMedia_.removeUpdateListener(this.onCastMediaUpdatedBound_); |
this.castMedia_ = null; |
} |
+ |
clearInterval(this.updateTimerId_); |
}, |
@@ -325,6 +341,9 @@ CastVideoElement.prototype = { |
console.error( |
'New token is requested, but the previous token mismatches.'); |
} |
+ } else if (message['message'] === 'playback-error') { |
+ if (message['detail'] === 'src-not-supported') |
+ this.errorCode_ = MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED; |
} |
}, |