Forum Discussion

slingxshot's avatar
slingxshot
Streaming Star
9 years ago

Is there an official contact/email I can use?

I am using one of Roku sample demos: https://github.com/rokudev/hero-grid-channel

This is an important project for the company I am building, however, I need to be able to add video element dynamically to the Poster element within the Grid on the fly that requires me to target the Poster.

However, in my other forum post, assigning an ID to the poster element did nothing. Using m.top.findNode does not seem to find it.

Is this a bug within the SDK? Is there a support email.

Thanks!

4 Replies

  • The best way to get help would be to post the complete code you're using for both your scene's .xml and .brs files.
  • slingxshot's avatar
    slingxshot
    Streaming Star
    <?xml version="1.0" encoding="utf-8" ?>
    <!-- Copyright 2016 Roku Corp.  All Rights Reserved. -->

    <component name="HeroScreen" extends="Group" initialFocus="RowListB">

      <children>  
           <Video
           id="videoPoster"
            translation="[355,10]"
            enableUI = "false"
            width = "1200"
            height="670" >
            <Poster
            id="videoPosterImage"
            uri="$$removed$$Long-IslandB.png"
            width="1200"
            height="670" /> 
        </Video>
            
        <RowList
       id="RowList"
          itemComponentName="customItem"
          focusXOffset="[167]"
          itemSize="[2050,220]"
          numRows="2"
          rowFocusAnimationStyle="floatingFocus"
          rowHeights="[415,415,415]"
          rowItemSize="[[400,295],[400,295],[400,295]]"
          rowItemSpacing="[[30,0]]"
          rowLabelOffset="[[165,8]]"
          showRowLabel="[true,true]"
          showRowCounter="[true,true,true]"
          translation="[-100,685]"/>
      </children>

      <interface>
        <!-- Grid Content Node -->
        <field id="content" type="node" alias="RowList.content" />

        <!-- Row item selection handler -->
        <field id="rowItemSelected" type="intarray" alias="RowList.rowItemSelected" alwaysnotify="true"/>

        <!-- Row item focused handler - sets background image uri and focusedContent field -->
        <field id="itemFocused" type="intarray" alias="RowList.rowItemFocused" onChange="OnItemFocused"/>   

        <!-- Interface to focused item (Content Node) -->
        <field id="focusedContent"  type="node"/>

        <!-- # of requests that have bad/no content (not a 200 response) -->
        <field id="numBadRequests" type="integer"/>
      </interface>

      <script type="text/brightscript" uri="pkg:/components/HeroScreen/HeroScreen.brs" />

    </component>

    ' ********** Copyright 2016 Roku Corp.  All Rights Reserved. **********

    ' Called when the HeroScreen component is initialized
    sub Init()
      'Uncomment the print statements to see where and when the functions are called
      'print "HeroScreen.brs - [init]"

      'Get references to child nodes
      m.RowList       =   m.top.findNode("RowList")
      m.UriHandler = CreateObject("roSGNode", "UriHandler")
      m.UriHandler.observeField("content", "onContentChanged")
      m.global.addFields( {red: &hff0000ff, green: &h00ff00ff, blue: &h0000ffff} ) 
      m.global.id = 0
      'Make a request for each "row" in the UI (in the order that you want content filled)
      URLs = [
        ' Uncomment this line to simulate a bad request and make the dialog box appear
        ' "bad request",
        "live.rss",
        "local.rss",
        "crime.rss",
        "tar.rss"
      ]
      makeRequest(URLs,"Parser")

      'Create observer events for when content is loaded
      m.top.observeField("visible", "onVisibleChange")
      m.top.observeField("focusedChild", "OnFocusedChildChange")
      
    end sub



    ' Issues a URL request to the UriHandler component
    sub makeRequest(URLs as object, ParserComponent as String)
      'print "HeroScreen.brs - [makeRequest]"
      for i = 0 to URLs.count() - 1
        context = createObject("roSGNode", "Node")
        uri = { uri: URLs[i] }
        if type(uri) = "roAssociativeArray"
          context.addFields({
            parameters: uri,
            num: i,
            response: {}
          })
          m.UriHandler.request = {
            context: context
            parser: ParserComponent
          }
        end if
      end for
    end sub

    ' observer function to handle when content loads
    sub onContentChanged()
      'print "HeroScreen.brs - [onContentChanged]"
      m.top.numBadRequests = m.UriHandler.numBadRequests
      m.top.content = m.UriHandler.content
    end sub

    ' handler of focused item in RowList
    sub OnItemFocused()
      print "HeroScreen.brs - [onItemFocused]"
      itemFocused = m.top.itemFocused 
       
      focusedContent = m.top.content.getChild(itemFocused[0]).getChild(itemFocused[1])  
         
      Poster = m.top.findNode("Poster1")
      
      print Poster
      
      'm.videoElm = m.Poster.createChild("Video")
      'm.videoElm.width = "400"
      'm.VideoElm.height = "280"
      
       'print m.top.rowItemSelected
      
      if itemFocused.Count() = 2 then
        focusedContent            = m.top.content.getChild(itemFocused[0]).getChild(itemFocused[1])
        if focusedContent <> invalid then
          m.top.focusedContent    = focusedContent
        end if
      end if
    end sub

    sub OnItemFocusedNode()
      print "HeroScreen.brs - [onItemFocusedNode]"
      'itemFocused = m.top.itemFocused 
      
      m.posterElm = m.top.findNode("posterElm")
        
    end sub


    ' sets proper focus to RowList in case channel returns from Details Screen
    sub onVisibleChange()
      print "HeroScreen.brs - [onVisibleChange]"
      if m.top.visible then m.RowList.setFocus(true)
    end sub

    ' set proper focus to RowList in case if return from Details Screen
    Sub onFocusedChildChange()
      print "HeroScreen.brs - [onFocusedChildChange]"
      if m.top.isInFocusChain() and not m.rowList.hasFocus() then m.rowList.setFocus(true)
    End Sub

    <?xml version="1.0" encoding="utf-8" ?>
    <!-- Copyright 2016 Roku Corp.  All Rights Reserved. -->

    <component name="customItem" extends="Group">

      <interface>
        <field id="width"       type="float" onChange="updateLayout"/>
        <field id="height"      type="float" onChange="updateLayout"/>
        <field id="itemContent" type="node" onChange="itemContentChanged" />
      </interface>

      <script type="text/brightscript">
        <![CDATA[
       
          sub Init()
            m.Poster = m.top.createChild("Poster") 

            id = m.global.id
            idInt = id.ToInt()
            idInt++
            m.global.id = idInt
            
            m.Poster.id = "Poster"+m.global.id+""       
            m.Poster.width = "400"
            m.Poster.height = "280"
            m.Poster.loadDisplayMode = "scaleToZoom"
            
           'm.Poster.observeField("focusedChild", "OnFocusedChildChange")
           'm.Label = m.top.findNode("label")

          end sub     
          

          sub itemContentChanged()
            
            m.Poster.uri = m.top.itemContent.HDPOSTERURL        
                     
          end sub
                ]]>
      </script>

      <children></children>
    </component>



    Poster = m.top.findNode("Poster1")
    print Poster

    returns invalid...
  • "slingxshot" wrote:
    in my other forum post, assigning an ID to the poster element did nothing. Using m.top.findNode does not seem to find it.

    Is this a bug within the SDK? Is there a support email.

    If there is clearly a bug, you can try reporting at the samlpe https://github.com/rokudev/hero-grid-channel/issues

    In theory you could email developer @roku.com but in practice, this year 9 out of 10 emails remain unanswered (from couple of feelers, RokuCo management are blissfully unaware of the fact). Even if they were answering all email though (which they could and should!), do realize that specific code customization help is provided only to a few, key "partners" - in Co's boutique parlance.

    From previous thread, it does not sound you have run into a bug proper - so like belltown suggests, best to show code in the forum, so it can be collectively dissected and triaged. That is known to work. Plus the rubber ducking effect which i can vouch for πŸ™‚
  • slingxshot's avatar
    slingxshot
    Streaming Star
    "EnTerr" wrote:
    "slingxshot" wrote:
    in my other forum post, assigning an ID to the poster element did nothing. Using m.top.findNode does not seem to find it.

    Is this a bug within the SDK? Is there a support email.

    If there is clearly a bug, you can try reporting at the samlpe https://github.com/rokudev/hero-grid-channel/issues

    In theory you could email developer @roku.com but in practice, this year 9 out of 10 emails remain unanswered (from couple of feelers, RokuCo management are blissfully unaware of the fact). Even if they were answering all email though (which they could and should!), do realize that specific code customization help is provided only to a few, key "partners" - in Co's boutique parlance.

    From previous thread, it does not sound you have run into a bug proper - so like @belltown suggests, best to show code in the forum, so it can be collectively dissected and triaged. That is known to work. Plus the rubber ducking effect which i can vouch for πŸ™‚

    The question might not be why my method doesn't work. But how can it be done.
    How would you dynamically add "video" element into rowlist item? Is there an alternative to RowList? Or like how would you change an image onFocus event... has anyone done that?