Domanda

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);
È stato utile?

Soluzione

Use

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top