mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update ConnectionManager
This commit is contained in:
parent
064140efd4
commit
19f2c8bdfb
2 changed files with 29 additions and 10 deletions
|
@ -790,11 +790,7 @@
|
||||||
var currentSrc = self.currentMediaElement.currentSrc.toLowerCase();
|
var currentSrc = self.currentMediaElement.currentSrc.toLowerCase();
|
||||||
var isStatic = currentSrc.indexOf('static=true') != -1;
|
var isStatic = currentSrc.indexOf('static=true') != -1;
|
||||||
|
|
||||||
var transcodingExtension = self.getTranscodingExtension();
|
var options = getVideoQualityOptions(self.currentMediaSource.MediaStreams);
|
||||||
|
|
||||||
var currentAudioStreamIndex = getParameterByName('AudioStreamIndex', self.currentMediaElement.currentSrc);
|
|
||||||
|
|
||||||
var options = getVideoQualityOptions(self.currentMediaSource.MediaStreams, currentAudioStreamIndex, transcodingExtension);
|
|
||||||
|
|
||||||
if (isStatic) {
|
if (isStatic) {
|
||||||
options[0].name = "Direct";
|
options[0].name = "Direct";
|
||||||
|
@ -1067,7 +1063,11 @@
|
||||||
EnableAutoStreamCopy: false
|
EnableAutoStreamCopy: false
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if (isStatic) mp4VideoUrl += seekParam;
|
if (isStatic) {
|
||||||
|
mp4VideoUrl += seekParam;
|
||||||
|
} else {
|
||||||
|
mp4VideoUrl += "&ClientTime=" + new Date().getTime();
|
||||||
|
}
|
||||||
|
|
||||||
var webmVideoUrl = ApiClient.getUrl('Videos/' + item.Id + '/stream.webm', $.extend({}, baseParams, {
|
var webmVideoUrl = ApiClient.getUrl('Videos/' + item.Id + '/stream.webm', $.extend({}, baseParams, {
|
||||||
VideoCodec: 'vpx',
|
VideoCodec: 'vpx',
|
||||||
|
@ -1113,6 +1113,12 @@
|
||||||
html += '<source type="application/x-mpegURL" src="' + hlsVideoUrl + '" />';
|
html += '<source type="application/x-mpegURL" src="' + hlsVideoUrl + '" />';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var mp4BeforeWebm = self.getVideoTranscodingExtension() != '.webm';
|
||||||
|
|
||||||
|
if (mp4BeforeWebm) {
|
||||||
|
html += '<source type="video/mp4" src="' + mp4VideoUrl + '" />';
|
||||||
|
}
|
||||||
|
|
||||||
// Have to put webm ahead of mp4 because it will play in fast forward in chrome
|
// Have to put webm ahead of mp4 because it will play in fast forward in chrome
|
||||||
// And firefox doesn't like fragmented mp4
|
// And firefox doesn't like fragmented mp4
|
||||||
if (!isStatic) {
|
if (!isStatic) {
|
||||||
|
@ -1120,7 +1126,9 @@
|
||||||
html += '<source type="video/webm" src="' + webmVideoUrl + '" />';
|
html += '<source type="video/webm" src="' + webmVideoUrl + '" />';
|
||||||
}
|
}
|
||||||
|
|
||||||
html += '<source type="video/mp4" src="' + mp4VideoUrl + '" />';
|
if (!mp4BeforeWebm) {
|
||||||
|
html += '<source type="video/mp4" src="' + mp4VideoUrl + '" />';
|
||||||
|
}
|
||||||
|
|
||||||
if (self.supportsTextTracks()) {
|
if (self.supportsTextTracks()) {
|
||||||
var textStreams = subtitleStreams.filter(function (s) {
|
var textStreams = subtitleStreams.filter(function (s) {
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
|
|
||||||
self.updateCanClientSeek = function (elem) {
|
self.updateCanClientSeek = function (elem) {
|
||||||
var duration = elem.duration;
|
var duration = elem.duration;
|
||||||
|
|
||||||
canClientSeek = duration && !isNaN(duration) && duration != Number.POSITIVE_INFINITY && duration != Number.NEGATIVE_INFINITY;
|
canClientSeek = duration && !isNaN(duration) && duration != Number.POSITIVE_INFINITY && duration != Number.NEGATIVE_INFINITY;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -71,7 +72,17 @@
|
||||||
}, intervalTime);
|
}, intervalTime);
|
||||||
};
|
};
|
||||||
|
|
||||||
self.getTranscodingExtension = function () {
|
self.getCurrentMediaExtension = function(currentSrc) {
|
||||||
|
currentSrc = currentSrc.split('?')[0];
|
||||||
|
|
||||||
|
return currentSrc.substring(currentSrc.lastIndexOf('.'));
|
||||||
|
};
|
||||||
|
|
||||||
|
self.getVideoTranscodingExtension = function (currentSrc) {
|
||||||
|
|
||||||
|
if (currentSrc) {
|
||||||
|
return self.getCurrentMediaExtension(currentSrc);
|
||||||
|
}
|
||||||
|
|
||||||
var media = testableVideoElement;
|
var media = testableVideoElement;
|
||||||
|
|
||||||
|
@ -108,7 +119,7 @@
|
||||||
|
|
||||||
if (self.currentItem.MediaType == "Video") {
|
if (self.currentItem.MediaType == "Video") {
|
||||||
|
|
||||||
transcodingExtension = self.getTranscodingExtension();
|
transcodingExtension = self.getVideoTranscodingExtension(currentSrc);
|
||||||
|
|
||||||
if (params.AudioStreamIndex != null) {
|
if (params.AudioStreamIndex != null) {
|
||||||
currentSrc = replaceQueryString(currentSrc, 'AudioStreamIndex', params.AudioStreamIndex);
|
currentSrc = replaceQueryString(currentSrc, 'AudioStreamIndex', params.AudioStreamIndex);
|
||||||
|
@ -140,7 +151,7 @@
|
||||||
if (finalParams.isStatic) {
|
if (finalParams.isStatic) {
|
||||||
currentSrc = currentSrc.replace('.webm', '.mp4').replace('.m3u8', '.mp4');
|
currentSrc = currentSrc.replace('.webm', '.mp4').replace('.m3u8', '.mp4');
|
||||||
} else {
|
} else {
|
||||||
currentSrc = currentSrc.replace('.mp4', transcodingExtension).replace('.m4v', transcodingExtension).replace('.mkv', transcodingExtension);
|
currentSrc = currentSrc.replace('.mp4', transcodingExtension).replace('.m4v', transcodingExtension).replace('.mkv', transcodingExtension).replace('.webm', transcodingExtension);
|
||||||
currentSrc = replaceQueryString(currentSrc, 'ClientTime', new Date().getTime());
|
currentSrc = replaceQueryString(currentSrc, 'ClientTime', new Date().getTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue