content: ' ********** Copyright 2016 Roku Corp.  All Rights Reserved. **********  
  
  sub init()
      m.Image       = m.top.findNode("Image")
      m.ButtonGroup = m.top.findNode("ButtonGroup")
      m.Details     = m.top.findNode("Details")
      m.Title       = m.top.findNode("Title")
      m.Video       = m.top.findNode("Video")
      m.Warning     = m.top.findNode("WarningDialog")
      m.Exiter      = m.top.findNode("Exiter")
      setContent()
      m.ButtonGroup.setFocus(true)
      m.ButtonGroup.observeField("buttonSelected","onButtonSelected")
  End sub
  
  sub onButtonSelected()
    'Ok'
    if m.ButtonGroup.buttonSelected = 0
      m.Video.visible = "true"
      m.Video.control = "play"
      m.Video.setFocus(true)
    'Exit button pressed'
    else
      m.Exiter.control = "RUN"
    end if
  end sub
  
  'Set your information here
  sub setContent()
  
    'Renved a static image and video into the my main scene     
    m.Image.uri="pkg:/images/Image-300x250.jpg"
    'm.Image.posterDisplayMode = scaleToFit
    ContentNode = CreateObject("roSGNode", "ContentNode")
    ContentNode.streamFormat = "mp4"
    ContentNode.url = "http://video.ted.com/talks/podcast/DanGilbert_2004_480.mp4"
    ContentNode.ShortDescriptionLine1 = "short description line1?"
    ContentNode.Description = "R. Kelly¡¯s explosive first TV appearance since being indicted, North Korea restarts a launch facility that could be used for ICBMs, and MIT¡¯s backflipping robot."
    ContentNode.StarRating = 80
    ContentNode.Length = 1972
    ContentNode.Title = "R. Kelly¡¯s explosive interview, North Korea revives a rocket site: NBC News Briefly"
    'ContentNode.subtitleConfig = {Trackname: "pkg:/source/xxxxx.srt" }
    
    m.Video.content = ContentNode
  
    'Change the buttons
    Buttons = ["Play","Exit"]
    m.ButtonGroup.buttons = Buttons
  
    'Change the details
    m.Title.text = "R. Kelly¡¯s explosive interview, North Korea revives a rocket site: NBC News Briefly"
    m.Details.text = "R. Kelly¡¯s explosive first TV appearance since being indicted, North Korea restarts a launch facility that could be used for ICBMs, and MIT¡¯s backflipping robot."
  
  end sub
  
  ' Called when a key on the remote is pressed
  function onKeyEvent(key as String, press as Boolean) as Boolean
    print "in MainScene.xml onKeyEvent ";key;" "; press
    if press then
      if key = "back"
        print "------ [back pressed] ------"
        if m.Warning.visible
          m.Warning.visible = false
          m.ButtonGroup.setFocus(true)
          return true
        else if m.Video.visible
          m.Video.control = "stop"
          m.Video.visible = false
          m.ButtonGroup.setFocus(true)
          return true
        else
          return false
        end if
      else if key = "OK"
        print "------- [ok pressed] -------"
        if m.Warning.visible
          m.Warning.visible = false
          m.ButtonGroup.setFocus(true)
          return true
        end if
      else
        return false
      end if
    end if
    return false
  end function
  