Handle videos with no audio track

This commit is contained in:
Neil Burrows 2020-07-11 09:32:46 +01:00
parent 325a03a8de
commit cfc9742944

View File

@ -130,7 +130,7 @@ function VideoContent(video) as object
end function end function
function getTranscodeParameters(meta as object) function getTranscodeParameters(meta as object)
if decodeAudioSupported(meta) then if decodeAudioSupported(meta) and meta.json.MediaStreams[1] <> invalid and meta.json.MediaStreams[1].Type = "Audio" then
audioCodec = meta.json.MediaStreams[1].codec audioCodec = meta.json.MediaStreams[1].codec
audioChannels = meta.json.MediaStreams[1].channels audioChannels = meta.json.MediaStreams[1].channels
else else
@ -221,6 +221,10 @@ function directPlaySupported(meta as object) as boolean
end function end function
function decodeAudioSupported(meta as object) as boolean function decodeAudioSupported(meta as object) as boolean
'Check for missing audio and allow playing
if meta.json.MediaStreams[1] = invalid or meta.json.MediaStreams[1].Type <> "Audio" then return true
devinfo = CreateObject("roDeviceInfo") devinfo = CreateObject("roDeviceInfo")
streamInfo = { Codec: meta.json.MediaStreams[1].codec, ChCnt: meta.json.MediaStreams[1].channels } streamInfo = { Codec: meta.json.MediaStreams[1].codec, ChCnt: meta.json.MediaStreams[1].channels }
if meta.json.MediaStreams[1].Bitrate <> invalid then if meta.json.MediaStreams[1].Bitrate <> invalid then