Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ignore broken audio tracks for videos with multiple audio tracks
Browse files Browse the repository at this point in the history
absidue committed Aug 10, 2023
1 parent d3a8988 commit 6ade288
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
@@ -596,7 +596,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)
@@ -628,7 +635,7 @@ export default defineComponent({
} else {
sourceLists[index].push(format)
}
})
}

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

0 comments on commit 6ade288

Please sign in to comment.