diff --git a/components/ItemGrid/LoadVideoContentTask.bs b/components/ItemGrid/LoadVideoContentTask.bs index 6e8e4a74d..10adf72ec 100644 --- a/components/ItemGrid/LoadVideoContentTask.bs +++ b/components/ItemGrid/LoadVideoContentTask.bs @@ -51,23 +51,23 @@ sub loadItems() id = m.top.itemId mediaSourceId = invalid audio_stream_idx = m.top.selectedAudioStreamIndex - if m.top.transcodeLiveTV = true + forceTranscoding = false + forceMP3Audio = false + if m.top.forceTranscodeMP3Audio = true print "forcing retry of Live TV with transcoding..." - forceTranscoding = true - else - forceTranscoding = false + forceMP3Audio = true end if - m.top.content = [LoadItems_VideoPlayer(id, mediaSourceId, audio_stream_idx, forceTranscoding)] + m.top.content = [LoadItems_VideoPlayer(id, mediaSourceId, audio_stream_idx, forceTranscoding, forceMP3Audio)] end sub -function LoadItems_VideoPlayer(id as string, mediaSourceId = invalid as dynamic, audio_stream_idx = 1 as integer, forceTranscoding = false as boolean) as dynamic +function LoadItems_VideoPlayer(id as string, mediaSourceId = invalid as dynamic, audio_stream_idx = 1 as integer, forceTranscoding = false as boolean, forceMP3Audio = false as boolean) as dynamic video = {} video.id = id video.content = createObject("RoSGNode", "ContentNode") - LoadItems_AddVideoContent(video, mediaSourceId, audio_stream_idx, forceTranscoding) + LoadItems_AddVideoContent(video, mediaSourceId, audio_stream_idx, forceTranscoding, forceMP3Audio) if video.content = invalid return invalid @@ -76,7 +76,7 @@ function LoadItems_VideoPlayer(id as string, mediaSourceId = invalid as dynamic, return video end function -sub LoadItems_AddVideoContent(video as object, mediaSourceId as dynamic, audio_stream_idx = 1 as integer, forceTranscoding = false as boolean) +sub LoadItems_AddVideoContent(video as object, mediaSourceId as dynamic, audio_stream_idx = 1 as integer, forceTranscoding = false as boolean, forceMP3Audio = false as boolean) meta = ItemMetaData(video.id) if not isValid(meta) @@ -167,7 +167,7 @@ sub LoadItems_AddVideoContent(video as object, mediaSourceId as dynamic, audio_s if not isValid(mediaSourceId) then mediaSourceId = video.id if meta.live then mediaSourceId = "" - m.playbackInfo = ItemPostPlaybackInfo(video.id, mediaSourceId, audio_stream_idx, subtitle_idx, playbackPosition, forceTranscoding) + m.playbackInfo = ItemPostPlaybackInfo(video.id, mediaSourceId, audio_stream_idx, subtitle_idx, playbackPosition, forceMP3Audio) if not isValid(m.playbackInfo) video.errorMsg = "Error loading playback info" video.content = invalid @@ -184,7 +184,7 @@ sub LoadItems_AddVideoContent(video as object, mediaSourceId as dynamic, audio_s video.SelectedSubtitle = defaultSubtitleIndex subtitle_idx = defaultSubtitleIndex - m.playbackInfo = ItemPostPlaybackInfo(video.id, mediaSourceId, audio_stream_idx, subtitle_idx, playbackPosition, forceTranscoding) + m.playbackInfo = ItemPostPlaybackInfo(video.id, mediaSourceId, audio_stream_idx, subtitle_idx, playbackPosition, forceMP3Audio) if not isValid(m.playbackInfo) video.errorMsg = "Error loading playback info" video.content = invalid diff --git a/components/ItemGrid/LoadVideoContentTask.xml b/components/ItemGrid/LoadVideoContentTask.xml index 0394e2223..eb3f52e37 100644 --- a/components/ItemGrid/LoadVideoContentTask.xml +++ b/components/ItemGrid/LoadVideoContentTask.xml @@ -21,6 +21,6 @@ - + \ No newline at end of file diff --git a/components/video/VideoPlayerView.bs b/components/video/VideoPlayerView.bs index ac8ac1fa2..75932cf71 100644 --- a/components/video/VideoPlayerView.bs +++ b/components/video/VideoPlayerView.bs @@ -354,7 +354,7 @@ sub onAudioIndexChange() end sub sub RetryLiveTV() - m.LoadMetaDataTask.transcodeLiveTV = true + m.LoadMetaDataTask.forceTranscodeMP3Audio = true m.LoadMetaDataTask.selectedSubtitleIndex = m.top.SelectedSubtitle m.LoadMetaDataTask.selectedAudioStreamIndex = m.top.audioIndex m.LoadMetaDataTask.itemId = m.currentItem.id diff --git a/source/api/Items.bs b/source/api/Items.bs index c61fd2557..5550ce28c 100644 --- a/source/api/Items.bs +++ b/source/api/Items.bs @@ -13,7 +13,7 @@ function ItemGetPlaybackInfo(id as string, startTimeTicks = 0 as longinteger) return getJson(resp) end function -function ItemPostPlaybackInfo(id as string, mediaSourceId = "" as string, audioTrackIndex = -1 as integer, subtitleTrackIndex = -1 as integer, startTimeTicks = 0 as longinteger, forceLiveTVTranscode = false) +function ItemPostPlaybackInfo(id as string, mediaSourceId = "" as string, audioTrackIndex = -1 as integer, subtitleTrackIndex = -1 as integer, startTimeTicks = 0 as longinteger, forceMP3 = false) params = { "UserId": m.global.session.user.id, "StartTimeTicks": startTimeTicks, @@ -39,16 +39,16 @@ function ItemPostPlaybackInfo(id as string, mediaSourceId = "" as string, audioT myGLobal = m.global - if audioTrackIndex > -1 and myGLobal.session.video.json.MediaStreams <> invalid or forceLiveTVTranscode + if audioTrackIndex > -1 and myGLobal.session.video.json.MediaStreams <> invalid or forceMP3 selectedAudioStream = myGLobal.session.video.json.MediaStreams[audioTrackIndex] - if selectedAudioStream <> invalid or forceLiveTVTranscode + if selectedAudioStream <> invalid or forceMP3 params.AudioStreamIndex = audioTrackIndex ' force the server to transcode AAC profiles we don't support to MP3 instead of the usual AAC ' TODO: Remove this after server adds support for transcoding AAC from one profile to another - if forceLiveTVTranscode or selectedAudioStream.Codec <> invalid and LCase(selectedAudioStream.Codec) = "aac" - if forceLiveTVTranscode or selectedAudioStream.Profile <> invalid and LCase(selectedAudioStream.Profile) = "main" or LCase(selectedAudioStream.Profile) = "he-aac" + if forceMP3 or selectedAudioStream.Codec <> invalid and LCase(selectedAudioStream.Codec) = "aac" + if forceMP3 or selectedAudioStream.Profile <> invalid and LCase(selectedAudioStream.Profile) = "main" or LCase(selectedAudioStream.Profile) = "he-aac" for each rule in deviceProfile.TranscodingProfiles if rule.Container = "ts" or rule.Container = "mp4" if rule.AudioCodec = "aac"