Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/renderer/helpers/api/local.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,18 @@ export async function getLocalVideoInfo(id) {

const info = await webInnertube.getInfo(id, { po_token: contentPoToken })

// temporary workaround for SABR-only responses
// #region temporary workaround for SABR-only responses

// MWEB doesn't have an audio track selector so it picks the audio track on the server based on the request language.

const originalAudioTrackFormat = info.streaming_data?.adaptive_formats.find(format => {
return format.has_audio && format.is_original && format.language
})

if (originalAudioTrackFormat) {
webInnertube.session.context.client.hl = originalAudioTrackFormat.language
}

const mwebInfo = await webInnertube.getBasicInfo(id, { client: 'MWEB', po_token: contentPoToken })

if (mwebInfo.playability_status.status === 'OK' && mwebInfo.streaming_data) {
Expand All @@ -240,6 +251,8 @@ export async function getLocalVideoInfo(id) {
clientName = 'MWEB'
}

// #endregion temporary workaround for SABR-only responses

let hasTrailer = info.has_trailer
let trailerIsAgeRestricted = info.getTrailerInfo() === null

Expand Down