Remove test AudioPlayer code
This commit is contained in:
parent
cc4f6ef3a6
commit
183ada1f5c
|
@ -1,100 +0,0 @@
|
|||
function AudioPlayer(id, mediaSourceId = invalid, audio_stream_idx = 1, subtitle_idx = -1)
|
||||
|
||||
' Get video controls and UI
|
||||
audio = CreateObject("roSGNode", "JFAudio")
|
||||
audio.id = id
|
||||
AddAudioContent(audio, mediaSourceId, audio_stream_idx, subtitle_idx)
|
||||
|
||||
if audio.content = invalid
|
||||
return invalid
|
||||
end if
|
||||
|
||||
audio.control = "stop"
|
||||
audio.control = "none"
|
||||
audio.control = "play"
|
||||
|
||||
return audio
|
||||
end function
|
||||
|
||||
sub AddAudioContent(video, mediaSourceId, audio_stream_idx = 1, subtitle_idx = -1, playbackPosition = -1)
|
||||
|
||||
video.content = createObject("RoSGNode", "ContentNode")
|
||||
meta = ItemMetaData(video.id)
|
||||
|
||||
m.videotype = meta.type
|
||||
if meta = invalid
|
||||
video.content = invalid
|
||||
return
|
||||
end if
|
||||
|
||||
' Special handling for "Programs" launched from "On Now"
|
||||
if meta.json.type = "Program"
|
||||
meta.title = meta.json.EpisodeTitle
|
||||
meta.showID = meta.json.id
|
||||
meta.live = true
|
||||
video.id = meta.json.ChannelId
|
||||
end if
|
||||
|
||||
video.content.title = meta.title
|
||||
video.showID = meta.showID
|
||||
|
||||
playbackPosition = 0
|
||||
|
||||
video.content.PlayStart = int(playbackPosition / 10000000)
|
||||
|
||||
video.videoId = video.id
|
||||
|
||||
params = {}
|
||||
|
||||
' video.container = getAudioContainerType(meta)
|
||||
video.streamformat = "mp3"
|
||||
|
||||
|
||||
' video.directPlaySupported = playbackInfo.MediaSources[0].SupportsDirectPlay
|
||||
video.directPlaySupported = true
|
||||
fully_external = false
|
||||
|
||||
' protocol = LCase(playbackInfo.MediaSources[0].Protocol)
|
||||
protocol = "file"
|
||||
if protocol <> "file"
|
||||
uriRegex = CreateObject("roRegex", "^(.*:)//([A-Za-z0-9\-\.]+)(:[0-9]+)?(.*)$", "")
|
||||
' uri = uriRegex.Match(playbackinfo.MediaSources[0].Path)
|
||||
uri = uriRegex.Match("")
|
||||
' proto $1, host $2, port $3, the-rest $4
|
||||
localhost = CreateObject("roRegex", "^localhost$|^127(?:\.[0-9]+){0,2}\.[0-9]+$|^(?:0*\:)*?:?0*1$", "i")
|
||||
' https://stackoverflow.com/questions/8426171/what-regex-will-match-all-loopback-addresses
|
||||
if localhost.isMatch(uri[2])
|
||||
' if the domain of the URI is local to the server,
|
||||
' create a new URI by appending the received path to the server URL
|
||||
' later we will substitute the users provided URL for this case
|
||||
video.content.url = buildURL(uri[4])
|
||||
else
|
||||
fully_external = true
|
||||
' video.content.url = playbackinfo.MediaSources[0].Path
|
||||
video.content.url = ""
|
||||
end if
|
||||
else:
|
||||
video.content.url = buildURL(Substitute("Audio/{0}/stream", video.id))
|
||||
end if
|
||||
|
||||
video.content.setCertificatesFile("common:/certs/ca-bundle.crt")
|
||||
|
||||
if not fully_external
|
||||
video.content = authorize_request(video.content)
|
||||
end if
|
||||
|
||||
end sub
|
||||
|
||||
function getAudioContainerType(meta as object) as string
|
||||
' Determine the file type of the video file source
|
||||
if meta.json.mediaSources = invalid then return ""
|
||||
|
||||
container = meta.json.mediaSources[0].container
|
||||
if container = invalid
|
||||
container = ""
|
||||
else if container = "m4v" or container = "mov"
|
||||
container = "mp4"
|
||||
end if
|
||||
|
||||
return container
|
||||
end function
|
|
@ -186,24 +186,8 @@ sub Main (args as dynamic) as void
|
|||
group = CreateMusicAlbumDetailsGroup(node)
|
||||
else if isNodeEvent(msg, "musicSongSelected")
|
||||
|
||||
' Bypass for now
|
||||
if false
|
||||
|
||||
' If you select a Music Song from ANYWHERE, follow this flow
|
||||
ptr = msg.getData()
|
||||
' ptr is for [row, col] of selected item... but we only have 1 row
|
||||
songs = msg.getRoSGNode()
|
||||
node = albums.musicArtistAlbumData.items[ptr[1]]
|
||||
|
||||
audio_id = node.id
|
||||
|
||||
audio = CreateAudioPlayerGroup(audio_id)
|
||||
|
||||
if audio <> invalid
|
||||
sceneManager.callFunc("pushScene", audio)
|
||||
end if
|
||||
|
||||
end if
|
||||
' Enjoy the silence
|
||||
message_dialog("Playing songs is not yet supported.")
|
||||
|
||||
else if isNodeEvent(msg, "episodeSelected")
|
||||
' If you select a TV Episode from ANYWHERE, follow this flow
|
||||
|
@ -393,13 +377,6 @@ sub Main (args as dynamic) as void
|
|||
|
||||
end sub
|
||||
|
||||
sub controlaudioplay()
|
||||
if (m.audio.state = "finished")
|
||||
m.audio.control = "stop"
|
||||
m.audio.control = "none"
|
||||
end if
|
||||
end sub
|
||||
|
||||
function LoginFlow(startOver = false as boolean)
|
||||
'Collect Jellyfin server and user information
|
||||
start_login:
|
||||
|
|
|
@ -398,16 +398,6 @@ function CreateVideoPlayerGroup(video_id, mediaSourceId = invalid, audio_stream_
|
|||
return video
|
||||
end function
|
||||
|
||||
function CreateAudioPlayerGroup(audio_id, mediaSourceId = invalid, audio_stream_idx = 1)
|
||||
' Audio is Playing
|
||||
audio = AudioPlayer(audio_id, mediaSourceId, audio_stream_idx)
|
||||
if audio = invalid then return invalid
|
||||
audio.observeField("selectSubtitlePressed", m.port)
|
||||
audio.observeField("state", m.port)
|
||||
|
||||
return audio
|
||||
end function
|
||||
|
||||
function CreatePersonView(personData as object) as object
|
||||
person = CreateObject("roSGNode", "PersonDetails")
|
||||
m.global.SceneManager.callFunc("pushScene", person)
|
||||
|
|
|
@ -131,7 +131,8 @@ function ItemMetaData(id as string)
|
|||
tmp.json = data
|
||||
return tmp
|
||||
else if data.type = "Audio"
|
||||
|
||||
print "Items.brs::ItemMetaData for Audio not yet supported"
|
||||
return data
|
||||
else
|
||||
print "Items.brs::ItemMetaData processed unhandled type: " data.type
|
||||
' Return json if we don't know what it is
|
||||
|
|
Loading…
Reference in New Issue
Block a user