启动后更新 Chromecast 接收器状态文本

Updating Chromecast receiver status text after start

在我的 Chromecast 自定义接收器上,我可以 set the status text 像这样:

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

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

此文本显示在潜在的演员表发件人身上。

我希望能够在接收器实例启动后更改此文本。这可能吗?如果可以,怎么办?

启动应用程序后,可以使用CastReceiverContext更改应用程序状态:

  // 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.

有关 official docs 的更多信息。