问题
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