如何在 Roku 上的视频中设置上方文字

How to Set Text above in Video on Roku

我尝试在视频上显示文字。我按下暂停键,然后再次在视频上方显示文本我按下相同的键,然后删除显示文本这在 Roku 中是可能的。

首先将您的标签添加为您的 Screen/View/Scene 的子节点,您还添加了视频节点,但请确保将其添加到您的视频节点之后,以便在其顶部呈现标签。因此,例如,在 You Screen/View/Scene 中,Video Node 应该是索引为 0 的子节点,Label 应该是索引为 1 的子节点。 在 Screen/View/Scene .xml 添加:

<Label
  id="testLabel"
  height="44"
  width="0"
  font="font:MediumBoldSystemFont"
  text = "Application Development Made Easy!"
  horizAlign = "left"
  vertAlign = "center"
  translation="[318,8]" />

在 Screen/View/Scene.brs 添加:m.testLabel = m.top.findNode("testLabel") 然后在Screen/View/Scene中添加一个onKey函数.brs:

function onKeyEvent(key as String, press as Boolean) as Boolean

  handled = false
  if press = true and key = "play"
      if videoNode.state = "playing"
        m.testLabel.visible = true
      else if videoNode.state = "paused"
        m.testLabel.visible = false
      end if
      handled = true
  end if

  return handled
end function