启动后更新Chromecast接收器状态文本 [英] Updating Chromecast receiver status text after start
问题描述
在我的Chromecast自定义接收器上,我可以设置状态文字,例如:
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?
推荐答案
已启动应用程序,可以使用 CastReceiverContext
更改应用程序状态:
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)
设置应用程序状态.应用程序应在其调用时调用它状态更改.如果未定义或设置为空字符串,则值在申请注册期间建立的申请名称为默认情况下用于应用程序状态.
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.
参数
statusText:string
状态文本.
有关官方文档.
这篇关于启动后更新Chromecast接收器状态文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!