Update API docs

This commit is contained in:
jellyfin-bot 2024-01-27 17:10:18 +00:00
parent 5efbc92b05
commit b7e4c4a0e6
8 changed files with 105 additions and 5 deletions

View File

@ -177,6 +177,7 @@ sub LoadItems_AddVideoContent(video as object, mediaSourceId as dynamic, audio_s
m.playbackInfo = meta.json
end if
addAudioStreamsToVideo(video)
if meta.live
video.transcodeParams = {
"MediaSourceId": m.playbackInfo.MediaSources[0].Id,
@ -357,6 +358,23 @@ sub addVideoContentURL(video, mediaSourceId, audio_stream_idx, fully_external)
end if
end sub
' addAudioStreamsToVideo: Add audio stream data to video
'
' @param {dynamic} video component to add fullAudioData to
sub addAudioStreamsToVideo(video)
audioStreams = []
mediaStreams = m.playbackInfo.MediaSources[0].MediaStreams
for i = 0 to mediaStreams.Count() - 1
if LCase(mediaStreams[i].Type) = "audio"
audioStreams.push(mediaStreams[i])
end if
end for
video.fullAudioData = audioStreams
end sub
sub addSubtitlesToVideo(video, meta)
subtitles = sortSubtitles(meta.id, m.playbackInfo.MediaSources[0].MediaStreams)
safesubs = subtitles["all"]

View File

@ -111,7 +111,8 @@ sub onContentDataChanged()
m.radioOptions.selectedIndex = i
end if
textLine = cardItem.CreateChild("SimpleLabel")
textLine = cardItem.CreateChild("ScrollingLabel")
textLine.maxWidth = "750"
textLine.text = item.track.description
cardItem.observeField("selected", "onItemSelected")
i++

View File

@ -16,6 +16,7 @@ sub CreateVideoPlayerView()
m.view.observeField("state", "onStateChange")
m.view.observeField("selectPlaybackInfoPressed", "onSelectPlaybackInfoPressed")
m.view.observeField("selectSubtitlePressed", "onSelectSubtitlePressed")
m.view.observeField("selectAudioPressed", "onSelectAudioPressed")
mediaSourceId = m.global.queueManager.callFunc("getCurrentItem").mediaSourceId
@ -34,6 +35,36 @@ end sub
' Event Handlers
' -----------------
' onSelectAudioPressed: Display audio selection dialog
'
sub onSelectAudioPressed()
audioData = {
data: []
}
for each item in m.view.fullAudioData
audioStreamItem = {
"Index": item.Index,
"IsExternal": item.IsExternal,
"Track": {
"description": item.DisplayTitle
},
"Type": "audioselection"
}
if m.view.audioIndex = item.Index
audioStreamItem.selected = true
end if
audioData.data.push(audioStreamItem)
end for
m.global.sceneManager.callFunc("radioDialog", tr("Select Audio"), audioData)
m.global.sceneManager.observeField("returnData", "onSelectionMade")
end sub
' User requested subtitle selection popup
sub onSelectSubtitlePressed()
' None is always first in the subtitle list
@ -87,6 +118,25 @@ sub onSelectionMade()
if LCase(m.global.sceneManager.returnData.type) = "subtitleselection"
processSubtitleSelection()
return
end if
if LCase(m.global.sceneManager.returnData.type) = "audioselection"
processAudioSelection()
return
end if
end sub
' processAudioSelection: Audio track selection handler
'
sub processAudioSelection()
selectedAudioTrack = m.global.sceneManager.returnData
if isValid(selectedAudioTrack)
if isValid(selectedAudioTrack.index)
m.view.audioIndex = selectedAudioTrack.index
end if
end if
end sub

View File

@ -34,6 +34,7 @@ sub init()
m.top.observeField("state", "onState")
m.top.observeField("content", "onContentChange")
m.top.observeField("selectedSubtitle", "onSubtitleChange")
m.top.observeField("audioIndex", "onAudioIndexChange")
' Custom Caption Function
m.top.observeField("allowCaptions", "onAllowCaptionsChange")
@ -165,6 +166,12 @@ sub handleShowSubtitleMenuAction()
m.top.selectSubtitlePressed = true
end sub
' handleShowAudioMenuAction: Handles action to show audio selection menu
'
sub handleShowAudioMenuAction()
m.top.selectAudioPressed = true
end sub
' handleShowVideoInfoPopupAction: Handles action to show video info popup
'
sub handleShowVideoInfoPopupAction()
@ -206,6 +213,11 @@ sub onOSDAction()
return
end if
if action = "showaudiomenu"
handleShowAudioMenuAction()
return
end if
if action = "showvideoinfopopup"
handleShowVideoInfoPopupAction()
return
@ -276,6 +288,24 @@ sub onSubtitleChange()
m.top.control = "stop"
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"
end sub
' Event handler for when audioIndex changes
sub onAudioIndexChange()
' Skip initial audio index setting
if m.top.position = 0 then return
' Save the current video position
m.global.queueManager.callFunc("setTopStartingPoint", int(m.top.position) * 10000000&)
m.top.control = "stop"
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"
@ -330,6 +360,7 @@ sub onVideoContentLoaded()
m.top.container = videoContent[0].container
m.top.mediaSourceId = videoContent[0].mediaSourceId
m.top.fullSubtitleData = videoContent[0].fullSubtitleData
m.top.fullAudioData = videoContent[0].fullAudioData
m.top.audioIndex = videoContent[0].audioIndex
m.top.transcodeParams = videoContent[0].transcodeparams
m.chapters = videoContent[0].chapters

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long