I am using the HelloTextGoogleCast sample's receiver.html. But I need to set the message bus's message type to JSON.

Here is part of it.

    // create a CastMessageBus to handle messages for a custom namespace
    window.messageBus =
      window.castReceiverManager.getCastMessageBus(
          'urn:x-cast:com.google.cast.sample.helloworld');

I tried this right after the above code. But it does not work:

 window.messageBus = window.castReceiverManager.getCastMessageBus(cast.receiver.CastMessageBus.MessageType.JSON);
有帮助吗?

解决方案

Use

window.messageBus = window.castReceiverManager.getCastMessageBus( 'urn:x-cast:com.google.cast.sample.helloworld', cast.receiver.CastMessageBus.MessageType.JSON);

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top