mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Merge branch 'master' into enable-airplay-audioplayer
This commit is contained in:
commit
12cf325e79
116 changed files with 5344 additions and 1453 deletions
|
@ -624,6 +624,7 @@ class ChromecastPlayer {
|
|||
isLocalPlayer: false,
|
||||
appName: PlayerName,
|
||||
deviceName: appName,
|
||||
deviceType: 'cast',
|
||||
supportedCommands: [
|
||||
'VolumeUp',
|
||||
'VolumeDown',
|
||||
|
|
|
@ -101,6 +101,7 @@ class HtmlAudioPlayer {
|
|||
self._currentTime = null;
|
||||
|
||||
const elem = createMediaElement();
|
||||
|
||||
return setCurrentSrc(elem, options);
|
||||
};
|
||||
|
||||
|
@ -110,6 +111,17 @@ class HtmlAudioPlayer {
|
|||
|
||||
let val = options.url;
|
||||
console.debug('playing url: ' + val);
|
||||
import('../../scripts/settings/userSettings').then((userSettings) => {
|
||||
if (userSettings.enableAudioNormalization() && options.item.LUFS != null) {
|
||||
const dbGain = -18 - options.item.LUFS;
|
||||
self.gainNode.gain.value = Math.pow(10, (dbGain / 20));
|
||||
} else {
|
||||
self.gainNode.gain.value = 1;
|
||||
}
|
||||
console.debug('gain:' + self.gainNode.gain.value);
|
||||
}).catch((err) => {
|
||||
console.error('Failed to add/change gainNode', err);
|
||||
});
|
||||
|
||||
// Convert to seconds
|
||||
const seconds = (options.playerStartPositionTicks || 0) / 10000000;
|
||||
|
@ -245,9 +257,29 @@ class HtmlAudioPlayer {
|
|||
|
||||
self._mediaElement = elem;
|
||||
|
||||
addGainElement(elem);
|
||||
|
||||
return elem;
|
||||
}
|
||||
|
||||
function addGainElement(elem) {
|
||||
try {
|
||||
const AudioContext = window.AudioContext || window.webkitAudioContext; /* eslint-disable-line compat/compat */
|
||||
|
||||
const audioCtx = new AudioContext();
|
||||
const source = audioCtx.createMediaElementSource(elem);
|
||||
|
||||
const gainNode = audioCtx.createGain();
|
||||
|
||||
source.connect(gainNode);
|
||||
gainNode.connect(audioCtx.destination);
|
||||
|
||||
self.gainNode = gainNode;
|
||||
} catch (e) {
|
||||
console.error('Web Audio API is not supported in this browser', e);
|
||||
}
|
||||
}
|
||||
|
||||
function onEnded() {
|
||||
htmlMediaHelper.onEndedInternal(self, this, onError);
|
||||
}
|
||||
|
|
|
@ -137,7 +137,10 @@ function zoomIn(elem) {
|
|||
}
|
||||
|
||||
function normalizeTrackEventText(text, useHtml) {
|
||||
const result = text.replace(/\\N/gi, '\n').replace(/\r/gi, '');
|
||||
const result = text
|
||||
.replace(/\\N/gi, '\n') // Correct newline characters
|
||||
.replace(/\r/gi, '') // Remove carriage return characters
|
||||
.replace(/{\\.*?}/gi, ''); // Remove ass/ssa tags
|
||||
return useHtml ? result.replace(/\n/gi, '<br>') : result;
|
||||
}
|
||||
|
||||
|
@ -1252,37 +1255,45 @@ export class HtmlVideoPlayer {
|
|||
const fallbackFontList = apiClient.getUrl('/FallbackFont/Fonts', {
|
||||
api_key: apiClient.accessToken()
|
||||
});
|
||||
const options = {
|
||||
video: videoElement,
|
||||
subUrl: getTextTrackUrl(track, item),
|
||||
fonts: avaliableFonts,
|
||||
fallbackFont: 'liberation sans',
|
||||
availableFonts: { 'liberation sans': `${appRouter.baseUrl()}/default.woff2` },
|
||||
// Disabled eslint compat, but is safe as corejs3 polyfills URL
|
||||
// eslint-disable-next-line compat/compat
|
||||
workerUrl: new URL('jassub/dist/jassub-worker.js', import.meta.url),
|
||||
// eslint-disable-next-line compat/compat
|
||||
legacyWorkerUrl: new URL('jassub/dist/jassub-worker-legacy.js', import.meta.url),
|
||||
timeOffset: (this._currentPlayOptions.transcodingOffsetTicks || 0) / 10000000,
|
||||
// new jassub options; override all, even defaults
|
||||
blendMode: 'js',
|
||||
asyncRender: true,
|
||||
// firefox implements offscreen canvas, but not according to spec which causes errors
|
||||
offscreenRender: !browser.firefox,
|
||||
// RVFC is polyfilled everywhere, but webOS 2 reports polyfill API's as functional even tho they aren't
|
||||
onDemandRender: browser.web0sVersion !== 2,
|
||||
useLocalFonts: true,
|
||||
dropAllAnimations: false,
|
||||
libassMemoryLimit: 40,
|
||||
libassGlyphLimit: 40,
|
||||
targetFps: 24,
|
||||
prescaleFactor: 0.8,
|
||||
prescaleHeightLimit: 1080,
|
||||
maxRenderHeight: 2160
|
||||
};
|
||||
// TODO: replace with `event-target-polyfill` once https://github.com/benlesh/event-target-polyfill/pull/12 or 11 is merged
|
||||
import('event-target-polyfill').then(() => {
|
||||
import('jassub').then(({ default: JASSUB }) => {
|
||||
// test SIMD support
|
||||
JASSUB._test();
|
||||
|
||||
const options = {
|
||||
video: videoElement,
|
||||
subUrl: getTextTrackUrl(track, item),
|
||||
fonts: avaliableFonts,
|
||||
fallbackFont: 'liberation sans',
|
||||
availableFonts: { 'liberation sans': `${appRouter.baseUrl()}/default.woff2` },
|
||||
// Disabled eslint compat, but is safe as corejs3 polyfills URL
|
||||
// eslint-disable-next-line compat/compat
|
||||
workerUrl: new URL('jassub/dist/jassub-worker.js', import.meta.url),
|
||||
// eslint-disable-next-line compat/compat
|
||||
wasmUrl: new URL('jassub/dist/jassub-worker.wasm', import.meta.url),
|
||||
// eslint-disable-next-line compat/compat
|
||||
legacyWasmUrl: new URL('jassub/dist/jassub-worker.wasm.js', import.meta.url),
|
||||
// eslint-disable-next-line compat/compat
|
||||
modernWasmUrl : new URL('jassub/dist/jassub-worker-modern.wasm', import.meta.url),
|
||||
timeOffset: (this._currentPlayOptions.transcodingOffsetTicks || 0) / 10000000,
|
||||
// new jassub options; override all, even defaults
|
||||
blendMode: 'js',
|
||||
asyncRender: true,
|
||||
offscreenRender: true,
|
||||
// RVFC is polyfilled everywhere, but webOS 2 reports polyfill API's as functional even tho they aren't
|
||||
onDemandRender: browser.web0sVersion !== 2,
|
||||
useLocalFonts: true,
|
||||
dropAllAnimations: false,
|
||||
dropAllBlur: !JASSUB._supportsSIMD,
|
||||
libassMemoryLimit: 40,
|
||||
libassGlyphLimit: 40,
|
||||
targetFps: 24,
|
||||
prescaleFactor: 0.8,
|
||||
prescaleHeightLimit: 1080,
|
||||
maxRenderHeight: 2160
|
||||
};
|
||||
|
||||
Promise.all([
|
||||
apiClient.getNamedConfiguration('encoding'),
|
||||
// Worker in Tizen 5 doesn't resolve relative path with async request
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue