From 4d57f98c0b9d60fc0e64e5ed23f4394459f62c4a Mon Sep 17 00:00:00 2001 From: jellyfin-bot Date: Mon, 18 Nov 2024 22:10:43 +0000 Subject: [PATCH 1/2] Bump build version --- Makefile | 2 +- manifest | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 05805174..a6e4a2e2 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ # If you want to get_images, you'll also need convert from ImageMagick ########################################################################## -VERSION := 2.2.4 +VERSION := 2.2.5 ## usage diff --git a/manifest b/manifest index ddf587fb..dd907d76 100644 --- a/manifest +++ b/manifest @@ -3,7 +3,7 @@ title=Jellyfin major_version=2 minor_version=2 -build_version=4 +build_version=5 ### Main Menu Icons / Channel Poster Artwork diff --git a/package-lock.json b/package-lock.json index 44ec1ea9..d53248cf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "jellyfin-roku", - "version": "2.2.4", + "version": "2.2.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "jellyfin-roku", - "version": "2.2.4", + "version": "2.2.5", "hasInstallScript": true, "license": "GPL-2.0", "dependencies": { diff --git a/package.json b/package.json index 09fb41e6..459660d4 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "jellyfin-roku", "type": "module", - "version": "2.2.4", + "version": "2.2.5", "description": "Roku app for Jellyfin media server", "dependencies": { "@rokucommunity/bslib": "0.1.1", From b9e7324a1237eb60c64efb523b45f1d59e891ea9 Mon Sep 17 00:00:00 2001 From: Charles Ewert Date: Tue, 19 Nov 2024 17:49:44 -0500 Subject: [PATCH 2/2] force mp3 audio when direct play fails because of unsupported aac stream --- components/ItemGrid/LoadVideoContentTask.bs | 5 +-- components/ItemGrid/LoadVideoContentTask.xml | 1 + components/video/VideoPlayerView.bs | 14 +++++++- components/video/VideoPlayerView.xml | 1 + source/api/Items.bs | 35 ++++++++++++-------- 5 files changed, 39 insertions(+), 17 deletions(-) diff --git a/components/ItemGrid/LoadVideoContentTask.bs b/components/ItemGrid/LoadVideoContentTask.bs index 69a5cce0..503b5b5b 100644 --- a/components/ItemGrid/LoadVideoContentTask.bs +++ b/components/ItemGrid/LoadVideoContentTask.bs @@ -54,6 +54,7 @@ sub loadItems() forceTranscoding = false m.top.content = [LoadItems_VideoPlayer(id, mediaSourceId, audio_stream_idx, forceTranscoding)] + m.top.forceMp3 = false end sub function LoadItems_VideoPlayer(id as string, mediaSourceId = invalid as dynamic, audio_stream_idx = 1 as integer, forceTranscoding = false as boolean) as dynamic @@ -157,7 +158,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) + m.playbackInfo = ItemPostPlaybackInfo(video.id, mediaSourceId, audio_stream_idx, subtitle_idx, playbackPosition, m.top.forceMp3) if not isValid(m.playbackInfo) video.errorMsg = "Error loading playback info" video.content = invalid @@ -174,7 +175,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) + m.playbackInfo = ItemPostPlaybackInfo(video.id, mediaSourceId, audio_stream_idx, subtitle_idx, playbackPosition, m.top.forceMp3) 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 f935c3e3..20a6317a 100644 --- a/components/ItemGrid/LoadVideoContentTask.xml +++ b/components/ItemGrid/LoadVideoContentTask.xml @@ -18,6 +18,7 @@ + diff --git a/components/video/VideoPlayerView.bs b/components/video/VideoPlayerView.bs index 109a5569..757795dc 100644 --- a/components/video/VideoPlayerView.bs +++ b/components/video/VideoPlayerView.bs @@ -34,7 +34,6 @@ sub init() m.playbackTimer = m.top.findNode("playbackTimer") m.bufferCheckTimer = m.top.findNode("bufferCheckTimer") - m.top.observeField("state", "onState") m.top.observeField("content", "onContentChange") m.top.observeField("selectedSubtitle", "onSubtitleChange") m.top.observeField("audioIndex", "onAudioIndexChange") @@ -397,6 +396,8 @@ sub onVideoContentLoaded() return end if + m.top.observeField("state", "onState") + m.top.content = videoContent[0].content m.top.PlaySessionId = videoContent[0].PlaySessionId m.top.videoId = videoContent[0].id @@ -639,6 +640,17 @@ sub onState(msg) if not m.playReported and m.top.transcodeAvailable m.top.retryWithTranscoding = true ' If playback was not reported, retry with transcoding + else if m.top.errorStr = "decoder:pump:Unsupported AAC stream." + m.log.info("retrying video with mp3 audio stream", m.currentItem.id, m.top.SelectedSubtitle, m.top.audioIndex) + + m.top.unobserveField("state") + m.LoadMetaDataTask.forceMp3 = true + m.LoadMetaDataTask.selectedSubtitleIndex = m.top.SelectedSubtitle + m.LoadMetaDataTask.selectedAudioStreamIndex = m.top.audioIndex + m.LoadMetaDataTask.itemId = m.currentItem.id + m.LoadMetaDataTask.observeField("content", "onVideoContentLoaded") + + m.LoadMetaDataTask.control = "RUN" else ' If an error was encountered, Display dialog showPlaybackErrorDialog(tr("Error During Playback")) diff --git a/components/video/VideoPlayerView.xml b/components/video/VideoPlayerView.xml index 2f7b67fe..d66e9126 100644 --- a/components/video/VideoPlayerView.xml +++ b/components/video/VideoPlayerView.xml @@ -20,6 +20,7 @@ + diff --git a/source/api/Items.bs b/source/api/Items.bs index 65ed564b..2dcf1234 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) +function ItemPostPlaybackInfo(id as string, mediaSourceId = "" as string, audioTrackIndex = -1 as integer, subtitleTrackIndex = -1 as integer, startTimeTicks = 0 as longinteger, forceMp3 = false as boolean) params = { "UserId": m.global.session.user.id, "StartTimeTicks": startTimeTicks, @@ -49,24 +49,14 @@ function ItemPostPlaybackInfo(id as string, mediaSourceId = "" as string, audioT ' TODO: Remove this after server adds support for transcoding AAC from one profile to another if selectedAudioStream.Codec <> invalid and LCase(selectedAudioStream.Codec) = "aac" if 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" - rule.AudioCodec = "mp3" - else if rule.AudioCodec.Left(4) = "aac," - rule.AudioCodec = mid(rule.AudioCodec, 5) - - if rule.AudioCodec.Left(3) <> "mp3" - rule.AudioCodec = "mp3," + rule.AudioCodec - end if - end if - end if - end for + forceMp3 = true end if end if end if end if + if forceMp3 then forceMp3Audio(deviceProfile) + req = APIRequest(Substitute("Items/{0}/PlaybackInfo", id), params) req.SetRequest("POST") return postJson(req, FormatJson({ "DeviceProfile": deviceProfile })) @@ -538,3 +528,20 @@ function TVEpisodeShuffleList(show_id as string) return data end function + +' updates the device profile we send the server to force mp3 audio transcoding instead of the default aac +sub forceMp3Audio(deviceProfile as object) + for each rule in deviceProfile.TranscodingProfiles + if rule.Container = "ts" or rule.Container = "mp4" + if rule.AudioCodec = "aac" + rule.AudioCodec = "mp3" + else if rule.AudioCodec.Left(4) = "aac," + rule.AudioCodec = mid(rule.AudioCodec, 5) + + if rule.AudioCodec.Left(3) <> "mp3" + rule.AudioCodec = "mp3," + rule.AudioCodec + end if + end if + end if + end for +end sub