mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
initial timeshifting support
This commit is contained in:
parent
2971ec0e69
commit
92e4d82bd2
12 changed files with 78 additions and 62 deletions
|
@ -11,7 +11,6 @@ define(['appSettings', 'userSettings', 'appStorage', 'datetime'], function (appS
|
|||
self.currentItem = null;
|
||||
self.currentMediaSource = null;
|
||||
|
||||
self.currentDurationTicks = null;
|
||||
self.startTimeTicksOffset = null;
|
||||
|
||||
self.playlist = [];
|
||||
|
@ -146,7 +145,7 @@ define(['appSettings', 'userSettings', 'appStorage', 'datetime'], function (appS
|
|||
|
||||
// viblast can help us here
|
||||
//return true;
|
||||
return window.MediaSource && !browserInfo.firefox;
|
||||
return window.MediaSource;
|
||||
};
|
||||
|
||||
self.changeStream = function (ticks, params) {
|
||||
|
@ -166,7 +165,13 @@ define(['appSettings', 'userSettings', 'appStorage', 'datetime'], function (appS
|
|||
var playSessionId = getParameterByName('PlaySessionId', currentSrc);
|
||||
var liveStreamId = getParameterByName('LiveStreamId', currentSrc);
|
||||
|
||||
Dashboard.getDeviceProfile().then(function (deviceProfile) {
|
||||
Dashboard.getDeviceProfile(null, {
|
||||
|
||||
enableMkvProgressive: self.currentMediaSource.RunTimeTicks != null,
|
||||
enableTsProgressive: self.currentMediaSource.RunTimeTicks != null,
|
||||
enableHls: !browserInfo.firefox || self.currentMediaSource.RunTimeTicks == null
|
||||
|
||||
}).then(function (deviceProfile) {
|
||||
|
||||
var audioStreamIndex = params.AudioStreamIndex == null ? (getParameterByName('AudioStreamIndex', currentSrc) || null) : params.AudioStreamIndex;
|
||||
if (typeof (audioStreamIndex) == 'string') {
|
||||
|
@ -264,6 +269,22 @@ define(['appSettings', 'userSettings', 'appStorage', 'datetime'], function (appS
|
|||
//self.updateTextStreamUrls(streamInfo.startTimeTicksOffset || 0);
|
||||
};
|
||||
|
||||
self.getSeekableDurationTicks = function () {
|
||||
|
||||
if (self.currentMediaSource && self.currentMediaSource.RunTimeTicks) {
|
||||
return self.currentMediaSource.RunTimeTicks;
|
||||
}
|
||||
|
||||
if (self.currentMediaRenderer) {
|
||||
var duration = self.currentMediaRenderer.duration();
|
||||
if (duration) {
|
||||
return duration * 10000;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
self.setCurrentTime = function (ticks, positionSlider, currentTimeElement) {
|
||||
|
||||
// Convert to ticks
|
||||
|
@ -272,13 +293,15 @@ define(['appSettings', 'userSettings', 'appStorage', 'datetime'], function (appS
|
|||
var timeText = datetime.getDisplayRunningTime(ticks);
|
||||
var mediaRenderer = self.currentMediaRenderer;
|
||||
|
||||
if (self.currentDurationTicks) {
|
||||
var seekableDurationTicks = self.getSeekableDurationTicks();
|
||||
|
||||
timeText += " / " + datetime.getDisplayRunningTime(self.currentDurationTicks);
|
||||
if (seekableDurationTicks) {
|
||||
|
||||
timeText += " / " + datetime.getDisplayRunningTime(seekableDurationTicks);
|
||||
|
||||
if (positionSlider) {
|
||||
|
||||
var percent = ticks / self.currentDurationTicks;
|
||||
var percent = ticks / seekableDurationTicks;
|
||||
percent *= 100;
|
||||
|
||||
positionSlider.value = percent;
|
||||
|
@ -287,7 +310,7 @@ define(['appSettings', 'userSettings', 'appStorage', 'datetime'], function (appS
|
|||
|
||||
if (positionSlider) {
|
||||
|
||||
positionSlider.disabled = !((self.currentDurationTicks || 0) > 0 || canPlayerSeek());
|
||||
positionSlider.disabled = !((seekableDurationTicks || 0) > 0 || canPlayerSeek());
|
||||
}
|
||||
|
||||
if (currentTimeElement) {
|
||||
|
@ -655,7 +678,13 @@ define(['appSettings', 'userSettings', 'appStorage', 'datetime'], function (appS
|
|||
}
|
||||
|
||||
var onBitrateDetected = function () {
|
||||
Dashboard.getDeviceProfile().then(function (deviceProfile) {
|
||||
Dashboard.getDeviceProfile(null, {
|
||||
|
||||
enableMkvProgressive: item.RunTimeTicks != null,
|
||||
enableTsProgressive: item.RunTimeTicks != null,
|
||||
enableHls: !browserInfo.firefox || item.RunTimeTicks == null
|
||||
|
||||
}).then(function (deviceProfile) {
|
||||
playOnDeviceProfileCreated(deviceProfile, item, startPosition, callback);
|
||||
});
|
||||
};
|
||||
|
@ -1516,7 +1545,6 @@ define(['appSettings', 'userSettings', 'appStorage', 'datetime'], function (appS
|
|||
Events.on(mediaRenderer, "timeupdate", onTimeUpdate);
|
||||
|
||||
self.currentMediaRenderer = mediaRenderer;
|
||||
self.currentDurationTicks = self.currentMediaSource.RunTimeTicks;
|
||||
|
||||
mediaRenderer.init().then(function () {
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue