Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #13824 from huchengtw-moz/video/Bug_938967_00-00_i…
Browse files Browse the repository at this point in the history
…s_not_handle_correctly

Bug 938967 - [fugu][hamachi]The video had be sought to 00:00 could not b..., r=djf
  • Loading branch information
huchengtw-moz committed Nov 28, 2013
2 parents eedb072 + dab5999 commit fe33351
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions apps/video/js/video.js
Expand Up @@ -75,7 +75,7 @@ var pendingPick;
// But Camera and Gallery also need to use that hardware, and those three apps
// may only have one video playing at a time among them. So we need to be
// careful to relinquish the hardware when we are not visible.
var restoreTime;
var restoreTime = null;

// Videos recorded by our own camera have filenames of this form
var FROMCAMERA = /DCIM\/\d{3}MZLLA\/VID_\d{4}\.3gp$/;
Expand Down Expand Up @@ -982,12 +982,22 @@ function releaseVideo() {

// Call this when the app becomes visible again
function restoreVideo() {
if (!restoreTime) {
return;
}
// When restoreVideo is called, we assume we have currentVideo because the
// playerShowing is true.
setVideoUrl(dom.player, currentVideo, function() {
setPlayerSize();
dom.player.currentTime = restoreTime;
// Everything is ready, start to restore last playing time.
if (restoreTime !== null) {
// restore to the last time when we have a valid restoreTime.
dom.player.currentTime = restoreTime;
} else {
// When we don't have valid restoreTime, we need to restore to the last
// viewing position from metadata. When user taps on a unwatched video and
// presses home quickly, the dom.player may not finish the loading of
// video and the restoreTime is null. At the same case, the currentTime of
// metadata is still undefined because we haven't updateMetadata.
dom.player.currentTime = currentVideo.metadata.currentTime || 0;
}
});
}

Expand Down

0 comments on commit fe33351

Please sign in to comment.