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

update ConnectionManager

This commit is contained in:
Luke Pulverenti 2014-10-03 21:42:38 -04:00
parent 064140efd4
commit 19f2c8bdfb
2 changed files with 29 additions and 10 deletions

View file

@ -790,11 +790,7 @@
var currentSrc = self.currentMediaElement.currentSrc.toLowerCase();
var isStatic = currentSrc.indexOf('static=true') != -1;
var transcodingExtension = self.getTranscodingExtension();
var currentAudioStreamIndex = getParameterByName('AudioStreamIndex', self.currentMediaElement.currentSrc);
var options = getVideoQualityOptions(self.currentMediaSource.MediaStreams, currentAudioStreamIndex, transcodingExtension);
var options = getVideoQualityOptions(self.currentMediaSource.MediaStreams);
if (isStatic) {
options[0].name = "Direct";
@ -1067,7 +1063,11 @@
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, {
VideoCodec: 'vpx',
@ -1113,6 +1113,12 @@
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
// And firefox doesn't like fragmented mp4
if (!isStatic) {
@ -1120,7 +1126,9 @@
html += '<source type="video/webm" src="' + webmVideoUrl + '" />';
}
if (!mp4BeforeWebm) {
html += '<source type="video/mp4" src="' + mp4VideoUrl + '" />';
}
if (self.supportsTextTracks()) {
var textStreams = subtitleStreams.filter(function (s) {

View file

@ -39,6 +39,7 @@
self.updateCanClientSeek = function (elem) {
var duration = elem.duration;
canClientSeek = duration && !isNaN(duration) && duration != Number.POSITIVE_INFINITY && duration != Number.NEGATIVE_INFINITY;
};
@ -71,7 +72,17 @@
}, 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;
@ -108,7 +119,7 @@
if (self.currentItem.MediaType == "Video") {
transcodingExtension = self.getTranscodingExtension();
transcodingExtension = self.getVideoTranscodingExtension(currentSrc);
if (params.AudioStreamIndex != null) {
currentSrc = replaceQueryString(currentSrc, 'AudioStreamIndex', params.AudioStreamIndex);
@ -140,7 +151,7 @@
if (finalParams.isStatic) {
currentSrc = currentSrc.replace('.webm', '.mp4').replace('.m3u8', '.mp4');
} 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());
}