mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
adjust the first codec for hls streaming
This commit is contained in:
parent
3e4b27195c
commit
0d846fa06d
1 changed files with 21 additions and 27 deletions
|
@ -338,54 +338,48 @@ define(['browser'], function (browser) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const canPlayAacVideoAudio = videoTestElement.canPlayType('video/mp4; codecs="avc1.640029, mp4a.40.2"').replace(/no/, '');
|
const canPlayAacVideoAudio = videoTestElement.canPlayType('video/mp4; codecs="avc1.640029, mp4a.40.2"').replace(/no/, '');
|
||||||
|
const canPlayAc3VideoAudio = supportsAc3(videoTestElement);
|
||||||
|
const canPlayEac3VideoAudio = supportsEac3(videoTestElement);
|
||||||
|
const canPlayAc3VideoAudioInHls = supportsAc3InHls(videoTestElement);
|
||||||
|
|
||||||
// Only put mp3 first if mkv support is there
|
if (canPlayAc3VideoAudio) {
|
||||||
// Otherwise with HLS and mp3 audio we're seeing some browsers
|
|
||||||
// safari is lying
|
|
||||||
if (supportsAc3(videoTestElement)) {
|
|
||||||
videoAudioCodecs.push('ac3');
|
videoAudioCodecs.push('ac3');
|
||||||
|
if (canPlayEac3VideoAudio) {
|
||||||
const eAc3 = supportsEac3(videoTestElement);
|
|
||||||
if (eAc3) {
|
|
||||||
videoAudioCodecs.push('eac3');
|
videoAudioCodecs.push('eac3');
|
||||||
}
|
}
|
||||||
|
|
||||||
// This works in edge desktop, but not mobile
|
// This works in edge desktop, but not mobile
|
||||||
// TODO: Retest this on mobile
|
// TODO: Retest this on mobile
|
||||||
if (supportsAc3InHls(videoTestElement)) {
|
// Transcoding codec is the first in hlsVideoAudioCodecs
|
||||||
|
// Put ac3/eac3 first only when the audio channels > 2 and need transcoding
|
||||||
|
if (canPlayAc3VideoAudioInHls && physicalAudioChannels > 2) {
|
||||||
hlsVideoAudioCodecs.push('ac3');
|
hlsVideoAudioCodecs.push('ac3');
|
||||||
if (eAc3) {
|
if (canPlayEac3VideoAudio) {
|
||||||
hlsVideoAudioCodecs.push('eac3');
|
hlsVideoAudioCodecs.push('eac3');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (canPlayAacVideoAudio) {
|
||||||
|
videoAudioCodecs.push('aac');
|
||||||
|
hlsVideoAudioCodecs.push('aac');
|
||||||
|
}
|
||||||
|
|
||||||
if (supportsMp3VideoAudio) {
|
if (supportsMp3VideoAudio) {
|
||||||
videoAudioCodecs.push('mp3');
|
videoAudioCodecs.push('mp3');
|
||||||
|
|
||||||
// PS4 fails to load HLS with mp3 audio
|
// PS4 fails to load HLS with mp3 audio
|
||||||
if (!browser.ps4) {
|
if (!browser.ps4) {
|
||||||
// mp3 encoder only supports 2 channels, so only make that preferred if we're only requesting 2 channels
|
hlsVideoAudioCodecs.push('mp3');
|
||||||
// Also apply it for chromecast because it no longer supports AAC 5.1
|
|
||||||
if (physicalAudioChannels <= 2) {
|
|
||||||
hlsVideoAudioCodecs.push('mp3');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (canPlayAacVideoAudio) {
|
// For ac3/eac3 directstream
|
||||||
if (videoAudioCodecs.indexOf('aac') === -1) {
|
if (canPlayAc3VideoAudio) {
|
||||||
videoAudioCodecs.push('aac');
|
if (canPlayAc3VideoAudioInHls && hlsVideoAudioCodecs.indexOf('ac3') === -1) {
|
||||||
}
|
hlsVideoAudioCodecs.push('ac3');
|
||||||
|
if (canPlayEac3VideoAudio && hlsVideoAudioCodecs.indexOf('eac3') === -1) {
|
||||||
hlsVideoAudioCodecs.push('aac');
|
hlsVideoAudioCodecs.push('eac3');
|
||||||
}
|
|
||||||
|
|
||||||
if (supportsMp3VideoAudio) {
|
|
||||||
// PS4 fails to load HLS with mp3 audio
|
|
||||||
if (!browser.ps4) {
|
|
||||||
if (hlsVideoAudioCodecs.indexOf('mp3') === -1) {
|
|
||||||
hlsVideoAudioCodecs.push('mp3');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue