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

Unified Diff: chrome/browser/resources/file_manager/js/media/video_player.js

Issue 10917188: Make Chrome OS Audio Player survive page reload and OS restart. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed debug trace Created 8 years, 3 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
Index: chrome/browser/resources/file_manager/js/media/video_player.js
diff --git a/chrome/browser/resources/file_manager/js/media/video_player.js b/chrome/browser/resources/file_manager/js/media/video_player.js
index 4a3b242ea933852d090427f64bdfab74d23507f0..a27cbbd2c0060fc92cfe16f3fd4eb1e597bde6b8 100644
--- a/chrome/browser/resources/file_manager/js/media/video_player.js
+++ b/chrome/browser/resources/file_manager/js/media/video_player.js
@@ -51,33 +51,16 @@ FullWindowVideoControls.prototype = { __proto__: VideoControls.prototype };
* the page reload.
*/
FullWindowVideoControls.prototype.onPlayStateChanged = function() {
- if (!this.getMedia().duration)
- return;
-
- var playState = (this.isPlaying() ? 'play' : 'pause') + '=' +
- this.getMedia().currentTime.toFixed(2);
-
- var newLocation = document.location.origin + document.location.pathname +
- document.location.search + '#' + playState;
-
- history.replaceState(undefined, playState, newLocation);
+ this.encodeStateIntoLocation();
};
/**
- * Resume the play state after the video is loaded.
+ * Restore the play state after the video is loaded.
*/
-FullWindowVideoControls.prototype.resumePosition = function() {
- var video = this.getMedia();
-
- var playState = document.location.hash.substring(1);
- if (playState) {
- var parts = playState.split('=');
- video.currentTime = parseFloat(parts[1]);
- if (parts[0] != 'pause')
- video.play();
- } else {
- VideoControls.prototype.resumePosition.apply(this, arguments);
- video.play();
+FullWindowVideoControls.prototype.restorePlayState = function() {
+ if (!this.decodeStateFromLocation()) {
+ VideoControls.prototype.restorePlayState.apply(this, arguments);
+ this.play();
}
};

Powered by Google App Engine
This is Rietveld 408576698