Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Level 7

combine sgdex timegrid with video

Hello. I am new to Roku development and I got lost. I am working on SGDEX timeGrid epg example. For days I have been tracing the code and trying to understand how it works. I was able to make some changes.  I added url to json files so each channel and program has its unique URL. I also examined their video example. What I am trying to do is when clicked on a program item on EPG it should open a video with the URL the program has. Following is the onclick function

 

   

     sub OnProgramSelected(event as Object)
        print "Entering TimeGridView.brs OnProgramSelected()"
        timeGrid = event.GetRoSGNode()
        m.top.rowItemSelected = [timeGrid.channelSelected, timeGrid.programSelected]

        
        print timeGrid.programSelected
        print timeGrid.channelSelected
        print m.top.rowItemSelected
        print m.view.content.getChild(0)  'prints the channel
        print m.view.content.getChild(timeGrid.channelSelected).getChild(timeGrid.programSelected) 'prints the program

        myNode = CreateObject("roSGNode", "ContentNode")
        myNode.focusable = false
        myNode.id = 1
        myNode.title = "Live Gaming Sample Content 1"
        myNode.URL = "https://some url.." 'I will pass the program url if this test works

        
        print myNode

        OpenVideoPlayerItem(myNode)


        print "Exiting TimeGridView.brs OnProgramSelected()"
    end sub

 

 

I took OpenVideoPlayerItem() function completely from SGDEX video example which is as follows:

   

   function OpenVideoPlayerItem(contentItem as Object) as Object
      ' Create MediaView Object and set its fields
      video = CreateObject("roSGNode", "MediaView")
      video.content = contentItem
      video.isContentList = false
      ' Set it to start playing, it wont begin playback until show() is called
      video.control = "play"
      ' Show the media view
      m.top.ComponentController.CallFunc("show", {
          view: video
      })
      return video
  end function

 

When I run the project it gives the following error:

 Interface not a member of BrightScript Component (runtime error &hf3) in pkg:/components/VideoPlayerLogic.brs(36) 036: m.top.ComponentController.CallFunc("show", { 

 

 

I do not understand the problem. I don't understand why it does not play and I do not know how to implement it correctly. The funny thing is once it started to play audio only although it gave the same error.

Tags (4)
0 Kudos
1 Reply
Highlighted

Re: combine sgdex timegrid with video

Here you do not maintain in a stack. It means the first view It's a "time grid" not closed and you tried to open a new view it's "video view". and given this error. so, It's not possible to open the view above view in Roku. First, you close the first view before opening another view.

0 Kudos