Skip to content

Commit e43d3fa

Browse files
committed
Update code docs
1 parent 61388ab commit e43d3fa

6 files changed

Lines changed: 41 additions & 58 deletions

docs/components_ItemGrid_LoadVideoContentTask.bs.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
forceTranscoding = false
5353

5454
m.top.content = [LoadItems_VideoPlayer(id, mediaSourceId, audio_stream_idx, forceTranscoding)]
55-
m.top.forceMp3 = false
5655
end sub
5756

5857
function LoadItems_VideoPlayer(id as string, mediaSourceId as dynamic, audio_stream_idx = 1 as integer, forceTranscoding = false as boolean) as dynamic
@@ -175,7 +174,7 @@
175174
if not isValid(mediaSourceId) then mediaSourceId = video.id
176175
if meta.live then mediaSourceId = ""
177176

178-
m.playbackInfo = ItemPostPlaybackInfo(video.id, mediaSourceId, audio_stream_idx, subtitle_idx, playbackPosition, m.top.forceMp3, meta)
177+
m.playbackInfo = ItemPostPlaybackInfo(video.id, mediaSourceId, audio_stream_idx, subtitle_idx, playbackPosition, meta)
179178
if not isValid(m.playbackInfo)
180179
video.errorMsg = "Error loading playback info"
181180
video.content = invalid
@@ -192,7 +191,7 @@
192191
video.SelectedSubtitle = defaultSubtitleIndex
193192
subtitle_idx = defaultSubtitleIndex
194193

195-
m.playbackInfo = ItemPostPlaybackInfo(video.id, mediaSourceId, audio_stream_idx, subtitle_idx, playbackPosition, m.top.forceMp3, meta)
194+
m.playbackInfo = ItemPostPlaybackInfo(video.id, mediaSourceId, audio_stream_idx, subtitle_idx, playbackPosition, meta)
196195
if not isValid(m.playbackInfo)
197196
video.errorMsg = "Error loading playback info"
198197
video.content = invalid
@@ -637,7 +636,7 @@
637636

638637
' Do we already have the MediaStreams or not?
639638
if not isValid(streams)
640-
url = Substitute("Users/{0}/Items/{1}", m.global.user.id, m.top.itemId)
639+
url = Substitute("Users/{0}/Items/{1}", localUser.id, m.top.itemId)
641640
resp = APIRequest(url)
642641
jsonResponse = getJson(resp)
643642

docs/components_video_VideoPlayerView.bs.html

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -690,18 +690,8 @@
690690
print m.top.errorInfo
691691

692692
if not m.playReported and m.top.transcodeAvailable
693+
m.log.info("retrying with transcoding", m.currentItem.id, m.top.SelectedSubtitle, m.top.audioIndex)
693694
m.top.retryWithTranscoding = true ' If playback was not reported, retry with transcoding
694-
else if m.top.errorStr = "decoder:pump:Unsupported AAC stream."
695-
m.log.info("retrying video with mp3 audio stream", m.currentItem.id, m.top.SelectedSubtitle, m.top.audioIndex)
696-
697-
m.top.unobserveField("state")
698-
m.LoadMetaDataTask.forceMp3 = true
699-
m.LoadMetaDataTask.selectedSubtitleIndex = m.top.SelectedSubtitle
700-
m.LoadMetaDataTask.selectedAudioStreamIndex = m.top.audioIndex
701-
m.LoadMetaDataTask.itemId = m.currentItem.id
702-
m.LoadMetaDataTask.observeField("content", "onVideoContentLoaded")
703-
704-
m.LoadMetaDataTask.control = "RUN"
705695
else
706696
' If an error was encountered, Display dialog
707697
m.top.unobserveField("state")

docs/module-Items.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/source_VideoPlayer.bs.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@
200200
end if
201201
end if
202202

203-
m.playbackInfo = ItemPostPlaybackInfo(video.id, mediaSourceId, audio_stream_idx, subtitle_idx, playbackPosition, false, meta)
203+
m.playbackInfo = ItemPostPlaybackInfo(video.id, mediaSourceId, audio_stream_idx, subtitle_idx, playbackPosition, meta)
204204
video.videoId = video.id
205205
video.mediaSourceId = mediaSourceId
206206
video.audioIndex = audio_stream_idx

docs/source_api_Items.bs.html

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,58 +6,58 @@
66
import "pkg:/source/utils/deviceCapabilities.bs"
77
import "pkg:/source/utils/misc.bs"
88

9-
function ItemPostPlaybackInfo(id as string, mediaSourceId = "" as string, audioTrackIndex = -1 as integer, subtitleTrackIndex = SubtitleSelection.none as integer, startTimeTicks = 0 as longinteger, forceMp3 = false as boolean, videoMetadata = invalid as dynamic)
10-
params = {
9+
function ItemPostPlaybackInfo(id as string, mediaSourceId = "" as string, audioTrackIndex = -1 as integer, subtitleTrackIndex = SubtitleSelection.none as integer, startTimeTicks = 0& as longinteger, videoMetadata = invalid as dynamic)
10+
postData = {
1111
"UserId": m.global.user.id,
1212
"StartTimeTicks": startTimeTicks,
13-
"IsPlayback": true,
14-
"AutoOpenLiveStream": true,
15-
"MaxStreamingBitrate": "140000000",
16-
"MaxStaticBitrate": "140000000",
17-
"SubtitleStreamIndex": subtitleTrackIndex
13+
"AutoOpenLiveStream": true
14+
' "AlwaysBurnInSubtitleWhenTranscoding": true
1815
}
19-
deviceProfile = getDeviceProfile()
16+
postData.DeviceProfile = getDeviceProfile()
17+
18+
if subtitleTrackIndex <> SubtitleSelection.none and subtitleTrackIndex <> SubtitleSelection.notset
19+
postData.SubtitleStreamIndex = subtitleTrackIndex
20+
end if
2021

2122
' Note: Jellyfin v10.9+ now remuxs LiveTV and does not allow DirectPlay anymore.
2223
' Because of this, we need to tell the server "EnableDirectPlay = false" so that we receive the
2324
' transcoding URL (which is just a remux and not a transcode; unless it is)
2425
' The web handles this by disabling EnableDirectPlay on a Retry, but we don't currently Retry a Live
2526
' TV stream, thus we just turn it off on the first try here.
2627
if mediaSourceId <> ""
27-
params.MediaSourceId = mediaSourceId
28+
postData.MediaSourceId = mediaSourceId
2829
else
2930
' No mediaSourceId? Must be LiveTV...
30-
params.EnableDirectPlay = false
31+
postData.EnableDirectPlay = false
3132
end if
3233

33-
if audioTrackIndex > -1 and isValid(videoMetadata) and isValid(videoMetadata.json) and isValid(videoMetadata.json.MediaStreams)
34-
' Find the audio stream with the matching Jellyfin index
35-
selectedAudioStream = invalid
36-
for each stream in videoMetadata.json.MediaStreams
37-
if isValid(stream.index) and stream.index = audioTrackIndex
38-
selectedAudioStream = stream
39-
exit for
40-
end if
41-
end for
42-
43-
if isValid(selectedAudioStream)
44-
params.AudioStreamIndex = audioTrackIndex
45-
46-
' force the server to transcode AAC profiles we don't support to MP3 instead of the usual AAC
47-
' TODO: Remove this after server adds support for transcoding AAC from one profile to another
48-
if isValid(selectedAudioStream.Codec) and LCase(selectedAudioStream.Codec) = "aac"
49-
if isValid(selectedAudioStream.Profile) and LCase(selectedAudioStream.Profile) = "main" or LCase(selectedAudioStream.Profile) = "he-aac"
50-
forceMp3 = true
34+
if audioTrackIndex > -1
35+
if isValid(videoMetadata) and isValid(videoMetadata.json) and isValid(videoMetadata.json.MediaStreams)
36+
' Find the audio stream with the matching Jellyfin index
37+
selectedAudioStream = invalid
38+
for each stream in videoMetadata.json.MediaStreams
39+
if isValid(stream.index) and stream.index = audioTrackIndex
40+
selectedAudioStream = stream
41+
exit for
42+
end if
43+
end for
44+
45+
if isValid(selectedAudioStream)
46+
postData.AudioStreamIndex = audioTrackIndex
47+
' force the server to transcode AAC profiles we don't support to MP3 instead of the usual AAC
48+
' TODO: Remove this after server adds support for transcoding AAC from one profile to another
49+
if isValid(selectedAudioStream.Codec) and LCase(selectedAudioStream.Codec) = "aac"
50+
if isValid(selectedAudioStream.Profile) and LCase(selectedAudioStream.Profile) = "main" or LCase(selectedAudioStream.Profile) = "he-aac"
51+
forceMp3Audio(postData.DeviceProfile)
52+
end if
5153
end if
5254
end if
5355
end if
5456
end if
5557

56-
if forceMp3 then forceMp3Audio(deviceProfile)
57-
58-
req = APIRequest(Substitute("Items/{0}/PlaybackInfo", id), params)
58+
req = APIRequest(Substitute("Items/{0}/PlaybackInfo", id))
5959
req.SetRequest("POST")
60-
return postJson(req, FormatJson({ "DeviceProfile": deviceProfile }))
60+
return postJson(req, FormatJson(postData))
6161
end function
6262

6363
' Search across all libraries

docs/source_utils_deviceCapabilities.bs.html

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"SupportsContentUploading": false,
1919
"SupportsSync": false,
2020
"DeviceProfile": getDeviceProfile(),
21-
"AppStoreUrl": ""
21+
"AppStoreUrl": "https://channelstore.roku.com/details/232f9e82db11ce628e3fe7e01382a330:a85d6e9e520567806e8dae1c0cabadd5/jellyrock"
2222
}
2323

2424
return deviceProfile
@@ -32,20 +32,14 @@
3232
"Identification": {
3333
"FriendlyName": globalDevice.friendlyName,
3434
"ModelNumber": globalDevice.model,
35-
"SerialNumber": "string",
3635
"ModelName": globalDevice.name,
3736
"ModelDescription": "Type: " + globalDevice.modelType,
3837
"Manufacturer": globalDevice.modelDetails.VendorName
3938
},
40-
"FriendlyName": globalDevice.friendlyName,
41-
"Manufacturer": globalDevice.modelDetails.VendorName,
42-
"ModelName": globalDevice.name,
43-
"ModelDescription": "Type: " + globalDevice.modelType,
44-
"ModelNumber": globalDevice.model,
45-
"SerialNumber": globalDevice.serial,
4639
"MaxStreamingBitrate": 120000000,
4740
"MaxStaticBitrate": 100000000,
48-
"MusicStreamingTranscodingBitrate": 192000,
41+
"MusicStreamingTranscodingBitrate": 320000, ' 320 kbps
42+
"MaxStaticMusicBitrate": 500000, ' 500 kbps - max bitrate for OGG files
4943
"DirectPlayProfiles": GetDirectPlayProfiles(),
5044
"TranscodingProfiles": getTranscodingProfiles(),
5145
"ContainerProfiles": getContainerProfiles(),

0 commit comments

Comments
 (0)