rokudev / multi-live-channel

Channel example of live TV in addition to multiple live streams support
Other
30 stars 26 forks source link

How to use Dynamic Channel from JSON URL #2

Open rkaartikeyan opened 7 years ago

rkaartikeyan commented 7 years ago

Hi,

I have JSON URL with Channels Ex: http://mytv.com/json.php

and i have coded in my config.brs like bellow

Function loadConfig() as Object
    channels = []
    request = CreateObject("roUrlTransfer")
    port = CreateObject("roMessagePort")
    request.SetMessagePort(port)
    request.SetUrl("http://mytv.com/json.php")
    jsonString = request.GetToString()

    json = ParseJSON(jsonString)
    for each channel in json.channels

        arrayElement = {
            Title: channel.Title
            streamFormat: channel.streamFormat
            Logo: channel.Logo
            Stream: channel.Stream
        }

        channels.push(arrayElement)
    end for

    return channels
End Function

But i am getting Following error in Console

------ Running dev 'MultiLive' main ------
BRIGHTSCRIPT: ERROR: roUrlTransfer: class PLUGIN|MARKUP on thread RENDER: pkg:/components/Config.brs(6)
BRIGHTSCRIPT: ERROR: roMessagePort: Trying to construct a message port on a non-plugin thread: pkg:/components/Config.brs(7)

BrightScript Micro Debugger.
Enter any BrightScript statement, debug commands, or HELP.

Suspending threads...
Thread selected:  1*   pkg:/components/Config.brs(8)           request.SetMessagePort(port)

Current Function:
004:  Function loadConfig() as Object
005:      channels = []
006:    request = CreateObject("roUrlTransfer")
007:    port = CreateObject("roMessagePort")
008:*     request.SetMessagePort(port)
009:      request.SetUrl("http://mytv.com/json.php")
010:      jsonString = request.GetToString()
011:

Please help me to resolve this. thanks.

yousufsk commented 5 years ago

i am also getting same issue pls help me out guys....