Begin looking into audio solutions

This commit is contained in:
Nick Bisby 2019-04-22 00:09:16 -05:00
parent 2964c36b45
commit a76eacb624
No known key found for this signature in database
GPG Key ID: F6E0C4E6D0B5EB36

View File

@ -22,12 +22,7 @@ function VideoContent(id) as object
meta = ItemMetaData(id)
content.title = meta.Name
container = meta.json.mediaSources[0].container
if container = invalid
container = ""
else if container = "m4v" or container = "mov"
container = "mp4"
end if
container = getContainerType(meta)
content.url = buildURL(Substitute("Videos/{0}/stream", id), {
Static: "true",
@ -39,6 +34,8 @@ function VideoContent(id) as object
content.streamformat = container
content.switchingStrategy = ""
' todo - audioFormat is read only
content.audioFormat = getAudioFormat(meta)
if server_is_https() then
content.setCertificatesFile("common:/certs/ca-bundle.crt")
@ -46,3 +43,35 @@ function VideoContent(id) as object
return content
end function
function getContainerType(meta as object) as string
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
function getAudioFormat(meta as object) as string
if meta.json.mediaSources = invalid then return ""
audioInfo = getAudioInfo(meta)
if audioInfo.count() = 0 then return ""
return audioInfo[0].codec
end function
function getAudioInfo(meta as object) as object
results = []
for each source in meta.json.mediaSources[0].mediaStreams
if source["type"] = "Audio"
results.push(source)
end if
end for
return results
end function