mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Merge pull request #5871 from gnattu/better-safari-profile
Better codec profile for Safari with 10.10 features
This commit is contained in:
commit
c9105dcad4
3 changed files with 37 additions and 7 deletions
|
@ -453,6 +453,7 @@ export default function (options) {
|
|||
|
||||
const canPlayVp8 = videoTestElement.canPlayType('video/webm; codecs="vp8"').replace(/no/, '');
|
||||
const canPlayVp9 = videoTestElement.canPlayType('video/webm; codecs="vp9"').replace(/no/, '');
|
||||
const safariSupportsOpus = browser.safari && !!document.createElement('audio').canPlayType('audio/x-caf; codecs="opus"').replace(/no/, '');
|
||||
const webmAudioCodecs = ['vorbis'];
|
||||
|
||||
const canPlayMkv = testCanPlayMkv(videoTestElement);
|
||||
|
@ -582,9 +583,11 @@ export default function (options) {
|
|||
if (browser.tizen) {
|
||||
hlsInTsVideoAudioCodecs.push('opus');
|
||||
}
|
||||
if (!browser.safari) {
|
||||
hlsInFmp4VideoAudioCodecs.push('opus');
|
||||
}
|
||||
hlsInFmp4VideoAudioCodecs.push('opus');
|
||||
} else if (safariSupportsOpus) {
|
||||
videoAudioCodecs.push('opus');
|
||||
webmAudioCodecs.push('opus');
|
||||
hlsInFmp4VideoAudioCodecs.push('opus');
|
||||
}
|
||||
|
||||
// FLAC audio in video plays with a delay on Tizen
|
||||
|
@ -657,7 +660,16 @@ export default function (options) {
|
|||
}
|
||||
|
||||
if (canPlayVp9) {
|
||||
mp4VideoCodecs.push('vp9');
|
||||
if (!browser.iOS) {
|
||||
// iOS safari may fail to direct play vp9 in mp4 container
|
||||
mp4VideoCodecs.push('vp9');
|
||||
}
|
||||
// Only iOS Safari's native HLS player understands vp9 in fmp4
|
||||
// This should be used in conjunction with forcing
|
||||
// using HLS.js for VP9 remuxing on desktop Safari.
|
||||
if (browser.safari) {
|
||||
hlsInFmp4VideoCodecs.push('vp9');
|
||||
}
|
||||
// webm support is unreliable on safari 17
|
||||
if (!browser.safari
|
||||
|| (browser.safari && browser.versionMajor >= 15 && browser.versionMajor < 17)) {
|
||||
|
@ -674,7 +686,7 @@ export default function (options) {
|
|||
}
|
||||
}
|
||||
|
||||
if (canPlayVp8 || browser.tizen) {
|
||||
if ((!browser.safari && canPlayVp8) || browser.tizen) {
|
||||
videoAudioCodecs.push('vorbis');
|
||||
}
|
||||
|
||||
|
@ -757,6 +769,14 @@ export default function (options) {
|
|||
}
|
||||
});
|
||||
|
||||
if (safariSupportsOpus) {
|
||||
profile.DirectPlayProfiles.push({
|
||||
Container: 'mp4',
|
||||
AudioCodec: 'opus',
|
||||
Type: 'Audio'
|
||||
});
|
||||
}
|
||||
|
||||
profile.TranscodingProfiles = [];
|
||||
|
||||
const hlsBreakOnNonKeyFrames = browser.iOS || browser.osx || browser.edge || !canPlayNativeHls();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue