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

Unified Diff: chrome/browser/resources/file_manager/js/image_editor/media_controls.js

Issue 9562003: Better resume for Video Player. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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: chrome/browser/resources/file_manager/js/image_editor/media_controls.js
diff --git a/chrome/browser/resources/file_manager/js/image_editor/media_controls.js b/chrome/browser/resources/file_manager/js/image_editor/media_controls.js
index 2bb4a9bc22e8beb68ad6ebc0b61a09861c9ebeb5..3994bbd5e9b00265e8e040843caea332886745e1 100644
--- a/chrome/browser/resources/file_manager/js/image_editor/media_controls.js
+++ b/chrome/browser/resources/file_manager/js/image_editor/media_controls.js
@@ -702,8 +702,7 @@ function VideoControls(containerElement, onMediaError,
VideoControls.RESUME_POSITIONS_CAPACITY = 100;
VideoControls.RESUME_POSITION_LIFETIME = 30 * 24 * 60 * 60 * 1000; // 30 days.
VideoControls.RESUME_MARGIN = 0.03;
-// Ignore the tail margin for videos shorter than 5 minutes.
-VideoControls.RESUME_TAIL_MARGIN_THRESHOLD = 5 * 60;
+VideoControls.RESUME_THRESHOLD = 5 * 60; // No resume for videos < 5 min.
VideoControls.RESUME_REWIND = 5; // Rewind 5 seconds back when resuming.
VideoControls.prototype = { __proto__: MediaControls.prototype };
@@ -752,7 +751,9 @@ VideoControls.prototype.togglePlayStateWithFeedback = function(e) {
VideoControls.prototype.onMediaDuration_ = function() {
MediaControls.prototype.onMediaDuration_.apply(this, arguments);
- if (this.media_.duration && this.media_.seekable) {
+ if (this.media_.duration &&
+ this.media_.duration >= VideoControls.RESUME_THRESHOLD &&
+ this.media_.seekable) {
var position = this.resumePositions_.getValue(this.media_.src);
if (position) {
this.media_.currentTime = position;
@@ -769,13 +770,13 @@ VideoControls.prototype.togglePlayState = function(e) {
};
VideoControls.prototype.savePosition = function() {
- if (!this.media_.duration)
+ if (!this.media_.duration ||
+ this.media_.duration_ < VideoControls.RESUME_THRESHOLD)
return;
var ratio = this.media_.currentTime / this.media_.duration;
if (ratio < VideoControls.RESUME_MARGIN ||
- (this.media_.duration >= VideoControls.RESUME_TAIL_MARGIN_THRESHOLD &&
- ratio > (1 - VideoControls.RESUME_MARGIN))) {
+ ratio > (1 - VideoControls.RESUME_MARGIN)) {
// We are too close to the beginning or the end.
// Remove the resume position so that next time we start from the beginning.
this.resumePositions_.removeValue(this.media_.src);
« 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