mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
3.0.5641.2
This commit is contained in:
parent
8590d1bd10
commit
4556c02e47
6 changed files with 150 additions and 123 deletions
|
@ -1,5 +1,7 @@
|
|||
(function () {
|
||||
|
||||
var supportsTextTracks;
|
||||
|
||||
function htmlMediaRenderer(type) {
|
||||
|
||||
var mediaElement;
|
||||
|
@ -261,6 +263,86 @@
|
|||
}
|
||||
};
|
||||
|
||||
self.supportsTextTracks = function () {
|
||||
|
||||
if (supportsTextTracks == null) {
|
||||
supportsTextTracks = document.createElement('video').textTracks != null;
|
||||
}
|
||||
|
||||
// For now, until ready
|
||||
return supportsTextTracks;
|
||||
};
|
||||
|
||||
self.setCurrentTrackElement = function (trackIndex) {
|
||||
|
||||
console.log('Setting new text track index to: ' + trackIndex);
|
||||
|
||||
var allTracks = mediaElement.textTracks; // get list of tracks
|
||||
|
||||
var modes = ['disabled', 'showing', 'hidden'];
|
||||
|
||||
for (var i = 0; i < allTracks.length; i++) {
|
||||
|
||||
var mode;
|
||||
|
||||
if (trackIndex == i) {
|
||||
mode = 1; // show this track
|
||||
} else {
|
||||
mode = 0; // hide all other tracks
|
||||
}
|
||||
|
||||
console.log('Setting track ' + i + ' mode to: ' + mode);
|
||||
|
||||
// Safari uses integers for the mode property
|
||||
// http://www.jwplayer.com/html5/scripting/
|
||||
var useNumericMode = false;
|
||||
|
||||
if (!isNaN(allTracks[i].mode)) {
|
||||
useNumericMode = true;
|
||||
}
|
||||
|
||||
if (useNumericMode) {
|
||||
allTracks[i].mode = mode;
|
||||
} else {
|
||||
allTracks[i].mode = modes[mode];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
self.updateTextStreamUrls = function (startPositionTicks) {
|
||||
|
||||
if (!self.supportsTextTracks()) {
|
||||
return;
|
||||
}
|
||||
|
||||
var allTracks = mediaElement.textTracks; // get list of tracks
|
||||
|
||||
for (var i = 0; i < allTracks.length; i++) {
|
||||
|
||||
var track = allTracks[i];
|
||||
|
||||
// This throws an error in IE, but is fine in chrome
|
||||
// In IE it's not necessary anyway because changing the src seems to be enough
|
||||
try {
|
||||
while (track.cues.length) {
|
||||
track.removeCue(track.cues[0]);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('Error removing cue from textTrack');
|
||||
}
|
||||
}
|
||||
|
||||
$('track', mediaElement).each(function () {
|
||||
|
||||
var currentSrc = this.src;
|
||||
|
||||
currentSrc = replaceQueryString(currentSrc, 'startPositionTicks', startPositionTicks);
|
||||
|
||||
this.src = currentSrc;
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
if (type == 'audio') {
|
||||
mediaElement = createAudioElement();
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@
|
|||
|
||||
self.setSubtitleStreamIndex = function (index) {
|
||||
|
||||
if (!self.supportsTextTracks()) {
|
||||
if (!self.currentMediaRenderer.supportsTextTracks()) {
|
||||
|
||||
self.changeStream(self.getCurrentTicks(), { SubtitleStreamIndex: index });
|
||||
self.currentSubtitleStreamIndex = index;
|
||||
|
@ -184,8 +184,6 @@
|
|||
|
||||
self.setCurrentTrackElement = function (index) {
|
||||
|
||||
var modes = ['disabled', 'showing', 'hidden'];
|
||||
|
||||
var textStreams = self.currentMediaSource.MediaStreams.filter(function (s) {
|
||||
return s.DeliveryMethod == 'External';
|
||||
});
|
||||
|
@ -196,70 +194,12 @@
|
|||
|
||||
var trackIndex = newStream ? textStreams.indexOf(newStream) : -1;
|
||||
|
||||
console.log('Setting new text track index to: ' + trackIndex);
|
||||
|
||||
var allTracks = self.currentMediaElement.textTracks; // get list of tracks
|
||||
|
||||
for (var i = 0; i < allTracks.length; i++) {
|
||||
|
||||
var mode;
|
||||
|
||||
if (trackIndex == i) {
|
||||
mode = 1; // show this track
|
||||
} else {
|
||||
mode = 0; // hide all other tracks
|
||||
}
|
||||
|
||||
console.log('Setting track ' + i + ' mode to: ' + mode);
|
||||
|
||||
// Safari uses integers for the mode property
|
||||
// http://www.jwplayer.com/html5/scripting/
|
||||
var useNumericMode = false;
|
||||
|
||||
if (!isNaN(allTracks[i].mode)) {
|
||||
useNumericMode = true;
|
||||
}
|
||||
|
||||
if (useNumericMode) {
|
||||
allTracks[i].mode = mode;
|
||||
} else {
|
||||
allTracks[i].mode = modes[mode];
|
||||
}
|
||||
}
|
||||
self.currentMediaRenderer.setCurrentTrackElement(trackIndex);
|
||||
};
|
||||
|
||||
self.updateTextStreamUrls = function (startPositionTicks) {
|
||||
|
||||
if (!self.supportsTextTracks()) {
|
||||
return;
|
||||
}
|
||||
|
||||
var allTracks = self.currentMediaElement.textTracks; // get list of tracks
|
||||
|
||||
for (var i = 0; i < allTracks.length; i++) {
|
||||
|
||||
var track = allTracks[i];
|
||||
|
||||
// This throws an error in IE, but is fine in chrome
|
||||
// In IE it's not necessary anyway because changing the src seems to be enough
|
||||
try {
|
||||
while (track.cues.length) {
|
||||
track.removeCue(track.cues[0]);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('Error removing cue from textTrack');
|
||||
}
|
||||
}
|
||||
|
||||
$('track', self.currentMediaElement).each(function () {
|
||||
|
||||
var currentSrc = this.src;
|
||||
|
||||
currentSrc = replaceQueryString(currentSrc, 'startPositionTicks', startPositionTicks);
|
||||
|
||||
this.src = currentSrc;
|
||||
|
||||
});
|
||||
self.currentMediaRenderer.updateTextStreamUrls(startPositionTicks);
|
||||
};
|
||||
|
||||
self.updateNowPlayingInfo = function (item) {
|
||||
|
@ -922,9 +862,9 @@
|
|||
var videoStream = self.currentMediaSource.MediaStreams.filter(function (stream) {
|
||||
return stream.Type == "Video";
|
||||
})[0];
|
||||
var videoWidth = videoStream ? videoStream.Width : null;
|
||||
var videoHeight = videoStream ? videoStream.Height : null;
|
||||
|
||||
var options = self.getVideoQualityOptions(videoWidth);
|
||||
var options = self.getVideoQualityOptions(videoHeight);
|
||||
|
||||
if (isStatic) {
|
||||
options[0].name = "Direct";
|
||||
|
|
|
@ -38,53 +38,56 @@
|
|||
|
||||
var canPlayAac = document.createElement('audio').canPlayType('audio/aac').replace(/no/, '');
|
||||
|
||||
self.getVideoQualityOptions = function (videoWidth) {
|
||||
self.getVideoQualityOptions = function (videoHeight) {
|
||||
|
||||
var bitrateSetting = AppSettings.maxStreamingBitrate();
|
||||
|
||||
var maxAllowedWidth = videoWidth || 4096;
|
||||
var maxAllowedHeight = videoHeight || 2304;
|
||||
|
||||
var options = [];
|
||||
|
||||
// Some 1080- videos are reported as 1912?
|
||||
if (maxAllowedWidth >= 1900) {
|
||||
options.push({ name: '1080p - 30Mbps', maxWidth: 1920, bitrate: 30000000 });
|
||||
options.push({ name: '1080p - 25Mbps', maxWidth: 1920, bitrate: 25000000 });
|
||||
options.push({ name: '1080p - 20Mbps', maxWidth: 1920, bitrate: 20000000 });
|
||||
options.push({ name: '1080p - 15Mbps', maxWidth: 1920, bitrate: 15000000 });
|
||||
options.push({ name: '1080p - 10Mbps', maxWidth: 1920, bitrate: 10000000 });
|
||||
options.push({ name: '1080p - 8Mbps', maxWidth: 1920, bitrate: 8000000 });
|
||||
options.push({ name: '1080p - 6Mbps', maxWidth: 1920, bitrate: 6000000 });
|
||||
options.push({ name: '1080p - 5Mbps', maxWidth: 1920, bitrate: 5000000 });
|
||||
} else if (maxAllowedWidth >= 1260) {
|
||||
options.push({ name: '720p - 10Mbps', maxWidth: 1280, bitrate: 10000000 });
|
||||
options.push({ name: '720p - 8Mbps', maxWidth: 1280, bitrate: 8000000 });
|
||||
options.push({ name: '720p - 6Mbps', maxWidth: 1280, bitrate: 6000000 });
|
||||
options.push({ name: '720p - 5Mbps', maxWidth: 1280, bitrate: 5000000 });
|
||||
} else if (maxAllowedWidth >= 460) {
|
||||
options.push({ name: '480p - 4Mbps', maxWidth: 720, bitrate: 4000000 });
|
||||
options.push({ name: '480p - 3Mbps', maxWidth: 720, bitrate: 3000000 });
|
||||
options.push({ name: '480p - 2.5Mbps', maxWidth: 720, bitrate: 2500000 });
|
||||
options.push({ name: '480p - 2Mbps', maxWidth: 720, bitrate: 2000000 });
|
||||
options.push({ name: '480p - 1.5Mbps', maxWidth: 720, bitrate: 1500000 });
|
||||
if (maxAllowedHeight >= 1060) {
|
||||
|
||||
options.push({ name: '1080p - 30Mbps', maxHeight: 1080, bitrate: 30000000 });
|
||||
options.push({ name: '1080p - 25Mbps', maxHeight: 1080, bitrate: 25000000 });
|
||||
options.push({ name: '1080p - 20Mbps', maxHeight: 1080, bitrate: 20000000 });
|
||||
options.push({ name: '1080p - 15Mbps', maxHeight: 1080, bitrate: 15000000 });
|
||||
options.push({ name: '1080p - 10Mbps', maxHeight: 1080, bitrate: 10000000 });
|
||||
options.push({ name: '1080p - 8Mbps', maxHeight: 1080, bitrate: 8000000 });
|
||||
options.push({ name: '1080p - 6Mbps', maxHeight: 1080, bitrate: 6000000 });
|
||||
options.push({ name: '1080p - 5Mbps', maxHeight: 1080, bitrate: 5000000 });
|
||||
|
||||
} else if (maxAllowedHeight >= 700) {
|
||||
options.push({ name: '720p - 10Mbps', maxHeight: 720, bitrate: 10000000 });
|
||||
options.push({ name: '720p - 8Mbps', maxHeight: 720, bitrate: 8000000 });
|
||||
options.push({ name: '720p - 6Mbps', maxHeight: 720, bitrate: 6000000 });
|
||||
options.push({ name: '720p - 5Mbps', maxHeight: 720, bitrate: 5000000 });
|
||||
|
||||
} else if (maxAllowedHeight >= 460) {
|
||||
options.push({ name: '480p - 4Mbps', maxHeight: 480, bitrate: 4000000 });
|
||||
options.push({ name: '480p - 3Mbps', maxHeight: 480, bitrate: 3000000 });
|
||||
options.push({ name: '480p - 2.5Mbps', maxHeight: 480, bitrate: 2500000 });
|
||||
options.push({ name: '480p - 2Mbps', maxHeight: 480, bitrate: 2000000 });
|
||||
options.push({ name: '480p - 1.5Mbps', maxHeight: 480, bitrate: 1500000 });
|
||||
}
|
||||
|
||||
if (maxAllowedWidth >= 1260) {
|
||||
options.push({ name: '720p - 4Mbps', maxWidth: 1280, bitrate: 4000000 });
|
||||
options.push({ name: '720p - 3Mbps', maxWidth: 1280, bitrate: 3000000 });
|
||||
options.push({ name: '720p - 2Mbps', maxWidth: 1280, bitrate: 2000000 });
|
||||
if (maxAllowedHeight >= 700) {
|
||||
options.push({ name: '720p - 4Mbps', maxHeight: 720, bitrate: 4000000 });
|
||||
options.push({ name: '720p - 3Mbps', maxHeight: 720, bitrate: 3000000 });
|
||||
options.push({ name: '720p - 2Mbps', maxHeight: 720, bitrate: 2000000 });
|
||||
|
||||
// The extra 1 is because they're keyed off the bitrate value
|
||||
options.push({ name: '720p - 1.5Mbps', maxWidth: 1280, bitrate: 1500001 });
|
||||
options.push({ name: '720p - 1Mbps', maxWidth: 1280, bitrate: 1000001 });
|
||||
options.push({ name: '720p - 1.5Mbps', maxHeight: 720, bitrate: 1500001 });
|
||||
options.push({ name: '720p - 1Mbps', maxHeight: 720, bitrate: 1000001 });
|
||||
}
|
||||
|
||||
options.push({ name: '480p - 1.0Mbps', maxWidth: 720, bitrate: 1000000 });
|
||||
options.push({ name: '480p - 720kbps', maxWidth: 720, bitrate: 720000 });
|
||||
options.push({ name: '480p - 420kbps', maxWidth: 720, bitrate: 420000 });
|
||||
options.push({ name: '360p', maxWidth: 640, bitrate: 400000 });
|
||||
options.push({ name: '240p', maxWidth: 426, bitrate: 320000 });
|
||||
options.push({ name: '144p', maxWidth: 256, bitrate: 192000 });
|
||||
options.push({ name: '480p - 1.0Mbps', maxHeight: 480, bitrate: 1000000 });
|
||||
options.push({ name: '480p - 720kbps', maxHeight: 480, bitrate: 720000 });
|
||||
options.push({ name: '480p - 420kbps', maxHeight: 480, bitrate: 420000 });
|
||||
options.push({ name: '360p', maxHeight: 360, bitrate: 400000 });
|
||||
options.push({ name: '240p', maxHeight: 240, bitrate: 320000 });
|
||||
options.push({ name: '144p', maxHeight: 144, bitrate: 192000 });
|
||||
|
||||
var i, length, option;
|
||||
var selectedIndex = -1;
|
||||
|
@ -107,12 +110,12 @@
|
|||
return options;
|
||||
};
|
||||
|
||||
self.getDeviceProfile = function (maxWidth) {
|
||||
self.getDeviceProfile = function (maxHeight) {
|
||||
|
||||
if (!maxWidth) {
|
||||
maxWidth = self.getVideoQualityOptions().filter(function (q) {
|
||||
if (!maxHeight) {
|
||||
maxHeight = self.getVideoQualityOptions().filter(function (q) {
|
||||
return q.selected;
|
||||
})[0].maxWidth;
|
||||
})[0].maxHeight;
|
||||
}
|
||||
|
||||
var bitrateSetting = AppSettings.maxStreamingBitrate();
|
||||
|
@ -348,8 +351,8 @@
|
|||
},
|
||||
{
|
||||
Condition: 'LessThanEqual',
|
||||
Property: 'Width',
|
||||
Value: maxWidth
|
||||
Property: 'Height',
|
||||
Value: maxHeight
|
||||
}]
|
||||
});
|
||||
|
||||
|
@ -365,8 +368,8 @@
|
|||
},
|
||||
{
|
||||
Condition: 'LessThanEqual',
|
||||
Property: 'Width',
|
||||
Value: maxWidth
|
||||
Property: 'Height',
|
||||
Value: maxHeight
|
||||
}]
|
||||
});
|
||||
|
||||
|
@ -403,6 +406,17 @@
|
|||
return profile;
|
||||
};
|
||||
|
||||
var supportsTextTracks;
|
||||
self.supportsTextTracks = function () {
|
||||
|
||||
if (supportsTextTracks == null) {
|
||||
supportsTextTracks = document.createElement('video').textTracks != null;
|
||||
}
|
||||
|
||||
// For now, until ready
|
||||
return supportsTextTracks;
|
||||
};
|
||||
|
||||
self.updateCanClientSeek = function (mediaRenderer) {
|
||||
|
||||
var duration = mediaRenderer.duration();
|
||||
|
@ -603,18 +617,6 @@
|
|||
$(self).trigger('positionchange', [state]);
|
||||
};
|
||||
|
||||
var supportsTextTracks;
|
||||
|
||||
self.supportsTextTracks = function () {
|
||||
|
||||
if (supportsTextTracks == null) {
|
||||
supportsTextTracks = document.createElement('video').textTracks != null;
|
||||
}
|
||||
|
||||
// For now, until ready
|
||||
return supportsTextTracks;
|
||||
};
|
||||
|
||||
self.canQueueMediaType = function (mediaType) {
|
||||
|
||||
return self.currentItem && self.currentItem.MediaType == mediaType;
|
||||
|
|
|
@ -1668,7 +1668,8 @@ var AppInfo = {};
|
|||
//localStorage.clear();
|
||||
function createConnectionManager(capabilities) {
|
||||
|
||||
var credentialProvider = new MediaBrowser.CredentialProvider();
|
||||
var credentialKey = Dashboard.isConnectMode() ? null : 'servercredentials4';
|
||||
var credentialProvider = new MediaBrowser.CredentialProvider(credentialKey);
|
||||
|
||||
window.ConnectionManager = new MediaBrowser.ConnectionManager(Logger, credentialProvider, AppInfo.appName, AppInfo.appVersion, AppInfo.deviceName, AppInfo.deviceId, capabilities);
|
||||
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
globalScope.MediaBrowser = {};
|
||||
}
|
||||
|
||||
globalScope.MediaBrowser.CredentialProvider = function () {
|
||||
globalScope.MediaBrowser.CredentialProvider = function (key) {
|
||||
|
||||
var self = this;
|
||||
var credentials = null;
|
||||
var key = 'servercredentials3';
|
||||
key = key || 'servercredentials3';
|
||||
|
||||
function ensure() {
|
||||
|
||||
|
|
|
@ -75,7 +75,9 @@
|
|||
}
|
||||
}
|
||||
|
||||
MainActivity.updateMediaSession(eventName, itemId, title, artist, album, parseInt(duration), parseInt(position), url, canSeek, isPaused);
|
||||
var isLocalPlayer = MediaController.getPlayerInfo().isLocalPlayer || false;
|
||||
|
||||
MainActivity.updateMediaSession(eventName, isLocalPlayer, itemId, title, artist, album, parseInt(duration), parseInt(position), url, canSeek, isPaused);
|
||||
lastUpdateTime = new Date().getTime();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue