bugfix + create helper function for searching array contents

This commit is contained in:
Charles Ewert 2023-08-31 16:02:39 -07:00
parent 8dd2c55df2
commit f572b8a4e2
2 changed files with 15 additions and 2 deletions

View File

@ -1,3 +1,5 @@
import "pkg:/source/utils/misc.brs"
'Device Capabilities for Roku.
'This will likely need further tweaking
function getDeviceCapabilities() as object
@ -794,17 +796,18 @@ function GetDirectPlayProfiles() as object
end if
end for
end for
' user settings override what the device thinks
if m.global.session.user.settings["playback.mpeg4"]
for each container in supportedCodecs
if supportedCodecs[container]["video"]["mpeg4"] = invalid
if not arrayHasValue(supportedCodecs[container]["video"], "mpeg4")
supportedCodecs[container]["video"].push("mpeg4")
end if
end for
end if
if m.global.session.user.settings["playback.mpeg2"]
for each container in supportedCodecs
if supportedCodecs[container]["video"]["mpeg2video"] = invalid
if not arrayHasValue(supportedCodecs[container]["video"], "mpeg2video")
supportedCodecs[container]["video"].push("mpeg2video")
end if
end for

View File

@ -367,3 +367,13 @@ sub stopLoadingSpinner()
m.scene.dialog.close = true
end if
end sub
' Check if a specific value is inside of an array
function arrayHasValue(arr as object, value as dynamic) as boolean
for each entry in arr
if entry = value
return true
end if
end for
return false
end function