【问题标题】:How to fetch image in Roku BrightScript?如何在 Roku BrightScript 中获取图像?
【发布时间】:2020-02-10 04:52:50
【问题描述】:

下面的 Curl 返回一个图像。我正在努力寻找 Roku 等效代码来获取图像并将其显示在海报节点中。

curl -X GET \
  https://xiorchestrate-xos-svc.prod.ocean.com:8443/xos/users/ocean-cf0183fb-9e93-4964-859b-XXXXXX/photos/profile \
  -H 'Accept: */*' \
  -H 'Authorization: Bearer XXXXX-9024-44b4-8552-d7d799ec00c8' \
  -H 'cache-control: no-cache'

有人可以帮我吗?

【问题讨论】:

    标签: roku brightscript


    【解决方案1】:

    Poster 节点实现了ifHttpAgent 接口,因此您应该能够在将uri 设置为海报之前使用SetHeaders(nameValueMap as Object) 函数。

    m.poster = m.top.createChild("Poster")
    m.poster.SetHeaders({"Authorization": "Bearer XXXXX-9024-44b4-8552-d7d799ec00c8", ...})
    m.poster.uri = "https://xiorchestrate-xos-svc.prod.ocean.com:8443/xos/users/ocean-cf0183fb-9e93-4964-859b-XXXXXX/photos/profile"
    

    【讨论】:

    • 谢谢。我一定会试试这个,并会告诉你。
    • 很高兴它成功了!如果对您有帮助,请随时接受答案?。
    【解决方案2】:

    您需要制作海报节点以在 roku 中实现图像。 创建一个带有<poster />标签的海报节点,带有id和其他东西,如宽度和高度以及翻译等。在 xml 中。 创建海报节点后,您需要在 brs 文件中使用 id 和 Findnode 方法查找节点,例如 m.poster_id = m.top.findnode("poster_id") 这里 m.poster_id 是我们初始化的 glbal 变量,用于执行其他操作。 现在,是时候将图像 uri 设置到海报节点中了:m.poster_id.uri = "images/image1.png"

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-11-27
      相关资源
      最近更新 更多