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

Merge branch 'master' into relax-hevc-safari

This commit is contained in:
Nyanmisaka 2024-03-07 16:13:44 +08:00 committed by GitHub
commit 4a7fc0662a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
85 changed files with 1567 additions and 2394 deletions

View file

@ -395,8 +395,7 @@ export function canPlaySecondaryAudio(videoTestElement) {
&& !browser.firefox
// It seems to work on Tizen 5.5+ (2020, Chrome 69+). See https://developer.tizen.org/forums/web-application-development/video-tag-not-work-audiotracks
&& (browser.tizenVersion >= 5.5 || !browser.tizen)
// Assume webOS 5+ (2020, Chrome 68+) supports secondary audio like Tizen 5.5+
&& (browser.web0sVersion >= 5.0 || !browser.web0sVersion);
&& (browser.web0sVersion >= 4.0 || !browser.web0sVersion);
}
export default function (options) {
@ -574,8 +573,8 @@ export default function (options) {
const hlsInFmp4VideoCodecs = [];
if (canPlayAv1(videoTestElement)
&& !browser.mobile && (browser.edgeChromium || browser.firefox || browser.chrome)) {
// disable av1 on mobile since it can be very slow software decoding
&& (browser.safari || (!browser.mobile && (browser.edgeChromium || browser.firefox || browser.chrome)))) {
// disable av1 on non-safari mobile browsers since it can be very slow software decoding
hlsInFmp4VideoCodecs.push('av1');
}
@ -616,12 +615,20 @@ export default function (options) {
if (canPlayVp9) {
mp4VideoCodecs.push('vp9');
webmVideoCodecs.push('vp9');
// webm support is unreliable on safari 17
if (!browser.safari
|| (browser.safari && browser.versionMajor >= 15 && browser.versionMajor < 17)) {
webmVideoCodecs.push('vp9');
}
}
if (canPlayAv1(videoTestElement)) {
mp4VideoCodecs.push('av1');
webmVideoCodecs.push('av1');
// webm support is unreliable on safari 17
if (!browser.safari
|| (browser.safari && browser.versionMajor >= 15 && browser.versionMajor < 17)) {
webmVideoCodecs.push('av1');
}
}
if (canPlayVp8 || browser.tizen) {

View file

@ -187,10 +187,15 @@ export default function (view) {
view.querySelector('.btnNewPlaylist').addEventListener('click', function () {
import('../components/playlisteditor/playlisteditor').then(({ default: PlaylistEditor }) => {
const serverId = ApiClient.serverInfo().Id;
new PlaylistEditor({
const playlistEditor = new PlaylistEditor();
playlistEditor.show({
items: [],
serverId: serverId
}).catch(() => {
// Dialog closed
});
}).catch(err => {
console.error('[btnNewPlaylist] failed to load playlist editor', err);
});
});
onViewStyleChange();

View file

@ -2,17 +2,17 @@ import focusManager from '../components/focusManager';
import dom from './dom';
import '../styles/scrollstyles.scss';
function getBoundingClientRect(elem) {
function getBoundingClientRect(elem: Element) {
// Support: BlackBerry 5, iOS 3 (original iPhone)
// If we don't have gBCR, just use 0,0 rather than error
if (elem.getBoundingClientRect) {
return elem.getBoundingClientRect();
} else {
return { top: 0, left: 0 };
return { top: 0, left: 0, width: undefined, height: undefined };
}
}
export function getPosition(scrollContainer, item, horizontal) {
export function getPosition(scrollContainer: HTMLElement, item: HTMLElement, horizontal: boolean) {
const slideeOffset = getBoundingClientRect(scrollContainer);
const itemOffset = getBoundingClientRect(item);
@ -41,7 +41,7 @@ export function getPosition(scrollContainer, item, horizontal) {
};
}
export function toCenter(container, elem, horizontal, skipWhenVisible) {
export function toCenter(container: HTMLElement, elem: HTMLElement, horizontal: boolean, skipWhenVisible?: boolean) {
const pos = getPosition(container, elem, horizontal);
if (skipWhenVisible && pos.isVisible) {
@ -61,7 +61,7 @@ export function toCenter(container, elem, horizontal, skipWhenVisible) {
}
}
export function toStart(container, elem, horizontal, skipWhenVisible) {
export function toStart(container: HTMLElement, elem: HTMLElement, horizontal: boolean, skipWhenVisible?: boolean) {
const pos = getPosition(container, elem, horizontal);
if (skipWhenVisible && pos.isVisible) {
@ -81,7 +81,7 @@ export function toStart(container, elem, horizontal, skipWhenVisible) {
}
}
function centerOnFocus(e, scrollSlider, horizontal) {
function centerOnFocus(e: Event, scrollSlider: HTMLElement, horizontal: boolean) {
const focused = focusManager.focusableParent(e.target);
if (focused) {
@ -89,16 +89,16 @@ function centerOnFocus(e, scrollSlider, horizontal) {
}
}
function centerOnFocusHorizontal(e) {
function centerOnFocusHorizontal(this: HTMLElement, e: Event) {
centerOnFocus(e, this, true);
}
function centerOnFocusVertical(e) {
function centerOnFocusVertical(this: HTMLElement, e: Event) {
centerOnFocus(e, this, false);
}
export const centerFocus = {
on: function (element, horizontal) {
on: function (element: Element, horizontal: boolean) {
element.setAttribute(`data-scroll-mode-${horizontal ? 'x' : 'y'}`, 'custom');
if (horizontal) {
@ -113,7 +113,7 @@ export const centerFocus = {
});
}
},
off: function (element, horizontal) {
off: function (element: Element, horizontal: boolean) {
element.removeAttribute(`data-scroll-mode-${horizontal ? 'x' : 'y'}`);
if (horizontal) {

View file

@ -35,7 +35,7 @@ export function getIncludeCorsCredentials() {
export function getMultiServer() {
// Enable multi-server support when served by webpack
if (__WEBPACK_SERVE__) { // eslint-disable-line no-undef
if (__WEBPACK_SERVE__) {
return Promise.resolve(true);
}