Forum Discussion

Croznut's avatar
Croznut
Reel Rookie
6 years ago

Parsing HLS Data From JSON File

Hey there, I'm in the final stages of setting up my feed and have run into an issue. My app loads, images, title, and descriptions pull in, but I can't for the life of me figure out how to get the HLS file to pull in...

The output of my JSON file looks like this (URLS and names have been pulled) ->

{
    "providerName": "NAME",
    "lastUpdated": "2019-12-18T22:21:37+00:00",
    "language": "en",

    "results":[
        {
            "title":"Title",
            "short_description":"Title",
            "hls_url":"VIDEO FILE",
            "thumbnail":"Image URL"
        },

 

I'm using a template provided by Roku which is below and am trying to figure out how to rewrite this so it pulls in the hls_url 

This is the original way it was written. How would i rewrite this to pull the hls file where it's listed above? 

function GetVideoUrl(mediaItem as Object) as String
content = mediaItem.Lookup("content")
if content = invalid then
return ""
end if

videos = content.Lookup("videos")
if videos = invalid then
return ""
end if

entry = videos.GetEntry(0)
if entry = invalid then
return ""
end if

url = entry.Lookup("url")
if url = invalid then
return ""
end if

return url
end function