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

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

Issue 523663002: Video Player: Show the appropriate error message on casting unsupported video (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . 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 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;
}
},
« 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