content: 'Initiates the Player SDK
  sub init()
      m.videoPlayer = m.top.findNode("videoPlayer")
      m.videoPlayer.observeField("state", "onVideoPlayerStateChange")
      m.videoPlayer.observeField("position", "onPositionChange")
      m.top.observeField("visible","onVisibleChange")
      m.subscribed = false
  end sub
  
  'Method to handle player view in terms of parent visibility
  sub onVisibleChange()
      if not m.top.visible
          m.videoPlayer.control="Stop"
      end if
  end sub
  
  'Player view handling in terms of states of playback
  sub onVideoPlayerStateChange()
      if m.videoPlayer.state = "finished" or m.videoPlayer.state = "error"
          m.videoPlayer.control="stop"
          m.top.close=true
      else if m.videoPlayer.state="buffering"
  
      else if m.videoPlayer.state = "playing"
      else if m.videoPlayer.state = "stopped"
          onPositionChange()
      end if
  end sub
  
  'Observer for video position
  sub onPositionChange()
      'm.videoPlayer.duration
      'm.videoPlayer.position
  end sub
  
  'Push video data to the player node 
  sub playerLoad()
      if m.top.playerContent <> invalid
          m.videoPlayer.content = m.top.playerContent
          m.videoPlayer.control = "Play"
          m.focusKey = 0
          updateFocus()
     end if
  end sub
  
  'Method to close player parent view
  sub closePlayerView()
      m.top.close = true
  end sub
  
  'Controlling focus over the parent and player UI
  sub setFocus()
      if m.focusKey <> invalid
          m.focusKey=m.focusKey
      else
          m.focusKey=0
      end if
      updateFocus()
  end sub
  
  'Method to Update the focus
  Sub updateFocus()
      if m.focusKey=0
          m.videoPlayer.setFocus(true)
      end if
  end sub
  
  'Function  that handles the Remotekeyevents
  '@param {string} key- The right,left, up, down,ok..etc remote button
  '@param {boolean} press- true if the button is pressed and false if button is not pressed
  '@return {boolean} true/false, flag indicates whether click processed by the component or not.
  sub onKeyEvent(key as string, press as boolean) as boolean
      result = false
      if press then
          if key = "back"
              if m.focusKey=0        
                  m.videoPlayer.content=invalid
                  m.top.close=true
                  result=true
              end if
          else if key = "left"
  
          else if key = "right"
  
          end if
      end if
  
      return result
  end sub