Updating Chromecast receiver status text after start

∥☆過路亽.° 提交于 2020-12-13 04:52:10

问题


On my Chromecast custom receiver, I can set the status text like so:

  const instance = cast.framework.CastReceiverContext.getInstance();

  const options = new cast.framework.CastReceiverOptions();
  options.statusText = 'Custom status text!!';
  
  instance.start(options);

This text is displayed on potential cast senders.

I'd like to be able to change this text after the receiver instance has already been started. Is this possible? If so, how can it be done?


回答1:


Having the application started, is possible to use CastReceiverContext to change the application status:

  // call setApplicationState and pass the new statusText
  instance.setApplicationState('New custom status text');

setApplicationState(statusText)

Sets the application state. The application should call this when its state changes. If undefined or set to an empty string, the value of the Application Name established during application registration is used for the application state by default.

Parameter

statusText:string

The status text.

More information on the official docs.



来源:https://stackoverflow.com/questions/64839760/updating-chromecast-receiver-status-text-after-start

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!