1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

fixes #317 - Pausing for too long stops media & hitting play goes back to the previous restore point

This commit is contained in:
Luke Pulverenti 2014-04-06 22:06:09 -04:00
parent f60a6df8ce
commit 1a1efc1646
2 changed files with 32 additions and 21 deletions

View file

@ -22,7 +22,6 @@
var fullscreenExited = false; var fullscreenExited = false;
var idleState = true; var idleState = true;
var remoteFullscreen = false; var remoteFullscreen = false;
var videoMenuVisible = false;
self.initVideoPlayer = function () { self.initVideoPlayer = function () {
video = playVideo(item, mediaSource, startPosition, user); video = playVideo(item, mediaSource, startPosition, user);
@ -263,7 +262,7 @@
video.removeClass("cursor-active").addClass("cursor-inactive"); video.removeClass("cursor-active").addClass("cursor-inactive");
videoControls.removeClass("active").addClass("inactive"); videoControls.removeClass("active").addClass("inactive");
}, 4000); }, 4000);
}; }
function requestFullScreen(element) { function requestFullScreen(element) {
@ -276,7 +275,7 @@
enterFullScreen(); enterFullScreen();
} }
}; }
function changeHandler(event) { function changeHandler(event) {
@ -284,7 +283,7 @@
fullscreenExited = self.isFullScreen() == false; fullscreenExited = self.isFullScreen() == false;
}); });
}; }
function enterFullScreen() { function enterFullScreen() {
@ -294,7 +293,7 @@
remoteFullscreen = true; remoteFullscreen = true;
}; }
function exitFullScreenToWindow() { function exitFullScreenToWindow() {
@ -304,7 +303,7 @@
remoteFullscreen = false; remoteFullscreen = false;
}; }
function toggleFlyout(flyout, button) { function toggleFlyout(flyout, button) {
@ -334,14 +333,14 @@
hideFlyout(flyout); hideFlyout(flyout);
} }
}; }
function hideFlyout(flyout) { function hideFlyout(flyout) {
flyout.slideUp().empty(); flyout.slideUp().empty();
$(document.body).off("mousedown.hidesearchhints"); $(document.body).off("mousedown.hidesearchhints");
}; }
function getChaptersFlyoutHtml() { function getChaptersFlyoutHtml() {
@ -400,7 +399,7 @@
} }
return html; return html;
}; }
function getAudioTracksHtml() { function getAudioTracksHtml() {
@ -468,7 +467,7 @@
} }
return html; return html;
}; }
function getSubtitleTracksHtml() { function getSubtitleTracksHtml() {
@ -541,7 +540,7 @@
} }
return html; return html;
}; }
function getQualityFlyoutHtml() { function getQualityFlyoutHtml() {
@ -582,7 +581,7 @@
} }
return html; return html;
}; }
function getInitialSubtitleStreamIndex(mediaStreams, user) { function getInitialSubtitleStreamIndex(mediaStreams, user) {
@ -621,7 +620,7 @@
} }
return null; return null;
}; }
function getInitialAudioStreamIndex(mediaStreams, user) { function getInitialAudioStreamIndex(mediaStreams, user) {
@ -651,7 +650,7 @@
// Just use the first audio stream // Just use the first audio stream
return audioStreams[0]; return audioStreams[0];
}; }
function getVideoQualityOptions(mediaStreams) { function getVideoQualityOptions(mediaStreams) {
@ -729,7 +728,7 @@
options[selectedIndex].selected = true; options[selectedIndex].selected = true;
return options; return options;
}; }
function playVideo(item, mediaSource, startPosition, user) { function playVideo(item, mediaSource, startPosition, user) {
@ -922,7 +921,7 @@
}, 300); }, 300);
// Pause stop timer // Pause stop timer
this.pauseStop = setTimeout(function () { self.pauseStop = setTimeout(function () {
self.stop(); self.stop();
}, 5 * 60 * 1000); // 5 minutes }, 5 * 60 * 1000); // 5 minutes
@ -936,8 +935,7 @@
}, 300); }, 300);
// Remove pause setop timer // Remove pause setop timer
window.clearTimeout(this.pauseStop); self.clearPauseStop();
delete this.pauseStop;
}).on("timeupdate", function () { }).on("timeupdate", function () {
@ -948,6 +946,8 @@
}).on("error", function () { }).on("error", function () {
self.clearPauseStop();
$("html").css("cursor", "default"); $("html").css("cursor", "default");
$(".ui-loader").hide(); $(".ui-loader").hide();
self.resetEnhancements(); self.resetEnhancements();
@ -1038,6 +1038,6 @@
currentMediaSource = mediaSource; currentMediaSource = mediaSource;
return videoElement[0]; return videoElement[0];
}; }
}; };
})(); })();

View file

@ -60,8 +60,19 @@
return Math.floor(10000000 * (mediaElement || currentMediaElement).currentTime) + self.startTimeTicksOffset; return Math.floor(10000000 * (mediaElement || currentMediaElement).currentTime) + self.startTimeTicksOffset;
}; };
self.clearPauseStop = function() {
if (self.pauseStop) {
console.log('clearing pause stop timer');
window.clearTimeout(self.pauseStop);
self.pauseStop = null;
}
};
self.onPlaybackStopped = function () { self.onPlaybackStopped = function () {
self.clearPauseStop();
$(this).off('ended.playbackstopped'); $(this).off('ended.playbackstopped');
self.currentTimeElement.empty(); self.currentTimeElement.empty();
@ -1159,7 +1170,7 @@
var getItemFields = "MediaSources,Chapters"; var getItemFields = "MediaSources,Chapters";
self.getCurrentTargetInfo = function() { self.getCurrentTargetInfo = function () {
return self.getTargets()[0]; return self.getTargets()[0];
}; };
} }