mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Better codec profile for Safari with 10.10 features
This uses the new VP9 remuxing and audio remuxing features to reduce transcoding on Safari, also removed some problematic direct play profiles. - Add opus profile for Safari - Add VP9 remuxing profile for Safari - Remove Vorbis profile on non-webm container for Safari - Remove direct VP9 playback in mp4 container for iOS Safari
This commit is contained in:
parent
d770e40130
commit
a386512def
3 changed files with 39 additions and 4 deletions
|
@ -451,6 +451,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);
|
||||
|
@ -580,7 +581,13 @@ export default function (options) {
|
|||
if (browser.tizen) {
|
||||
hlsInTsVideoAudioCodecs.push('opus');
|
||||
}
|
||||
if (!browser.safari) {
|
||||
hlsInFmp4VideoAudioCodecs.push('opus');
|
||||
}
|
||||
|
||||
if (browser.safari) {
|
||||
if (safariSupportsOpus) {
|
||||
videoAudioCodecs.push('opus');
|
||||
webmAudioCodecs.push('opus');
|
||||
hlsInFmp4VideoAudioCodecs.push('opus');
|
||||
}
|
||||
}
|
||||
|
@ -655,7 +662,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)) {
|
||||
|
@ -672,7 +688,7 @@ export default function (options) {
|
|||
}
|
||||
}
|
||||
|
||||
if (canPlayVp8 || browser.tizen) {
|
||||
if ((!browser.safari && canPlayVp8) || browser.tizen) {
|
||||
videoAudioCodecs.push('vorbis');
|
||||
}
|
||||
|
||||
|
@ -744,6 +760,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