Index: ui/file_manager/video_player/js/video_player.js |
diff --git a/ui/file_manager/video_player/js/video_player.js b/ui/file_manager/video_player/js/video_player.js |
index 38e16057b3d0fe46f52a77d79cf0e9cd7e6cc2ac..5c581a812efa26e998a735f18dfe9bc22c3d8865 100644 |
--- a/ui/file_manager/video_player/js/video_player.js |
+++ b/ui/file_manager/video_player/js/video_player.js |
@@ -503,9 +503,15 @@ VideoPlayer.prototype.onCastSelected_ = function(cast) { |
if ((this.currentCast_ && this.currentCast_.label) === (cast && cast.label)) |
return; |
- this.currentCast_ = cast || null; |
- this.updateCheckOnCastMenu_(); |
- this.reloadCurrentVideo(); |
+ this.unloadVideo(false); |
+ |
+ // Waits for unloading video. |
+ this.loadQueue_.run(function(callback) { |
+ this.currentCast_ = cast || null; |
+ this.updateCheckOnCastMenu_(); |
+ this.reloadCurrentVideo(); |
+ callback(); |
+ }.wrap(this)); |
}; |
/** |