diff --git a/src/components/Player.vue b/src/components/Player.vue index 2bee6b7..f9141f4 100644 --- a/src/components/Player.vue +++ b/src/components/Player.vue @@ -246,16 +246,29 @@ export default { if (qualityConds) { let leastDiff = Number.MAX_VALUE let bestStream = null + + let bestAudio = 0 + // Choose the best audio stream + if (qualityConds >= 480) { + player.getVariantTracks().forEach(track => { + const audioBandwidth = track.audioBandwidth + if (audioBandwidth > bestAudio) bestAudio = audioBandwidth + }) + } + player .getVariantTracks() .sort((a, b) => a.bandwidth - b.bandwidth) .forEach(stream => { + if (stream.audioBandwidth < bestAudio) return + const diff = Math.abs(quality - stream.height) if (diff < leastDiff) { leastDiff = diff bestStream = stream } }) + player.selectVariantTrack(bestStream) }