Skip to content

Commit

Permalink
Ignore broken audio tracks for videos with multiple audio tracks (#3851)
Browse files Browse the repository at this point in the history
  • Loading branch information
absidue authored Aug 20, 2023
1 parent 3236ce8 commit 4d4dcba
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/renderer/views/Watch/Watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,14 @@ export default defineComponent({
/** @type {import('youtubei.js').Misc.Format[][]} */
const sourceLists = []

audioFormats.forEach(format => {
for (const format of audioFormats) {
// Some videos with multiple audio tracks, have a broken one, that doesn't have any audio track information
// It seems to be the same as default audio track but broken
// At the time of writing, this video has a broken audio track: https://youtu.be/UJeSWbR6W04
if (!format.audio_track) {
continue
}

const index = ids.indexOf(format.audio_track.id)
if (index === -1) {
ids.push(format.audio_track.id)
Expand Down Expand Up @@ -632,7 +639,7 @@ export default defineComponent({
} else {
sourceLists[index].push(format)
}
})
}

for (let i = 0; i < audioTracks.length; i++) {
audioTracks[i].sourceList = this.createLocalAudioSourceList(sourceLists[i])
Expand Down

0 comments on commit 4d4dcba

Please sign in to comment.