I am using https://github.com/react-native-google-cast/react-native-google-cast library for integration google cast with react native for iOS.
I am getting channel init success but later while trying to send message to channel, I get sendTextMessage error Channel is not connected or is not registered with a session.
Here is the code -
sendMediaGetMessage() {
console.debug("entry: sendMediaGetMessage");
console.debug("WatchV:registering channel " + CastConstant.MESSAGE_CHANNEL);
GoogleCast.initChannel(CastConstant.MESSAGE_CHANNEL)
.then(() => {
console.debug("WatchV:channel init success");
GoogleCast.sendMessage(
CastConstant.MESSAGE_CHANNEL,
JSON.stringify({ intent: "get_media" })
)
.then(() => {})
.catch(error => {
console.log(error);
});
})
.catch(function(err) {
console.debug("WatchV:error: sendMediaGetMessage");
console.log(err);
});
}
I am using -
- pod 'react-native-google-cast/NoBluetooth', path: '../node_modules/react-native-google-cast/ios/'
- google-cast-sdk-no-bluetooth (4.4.6)
- Xcode 10.3
- React native 0.59
Note: Using a custom receiver app for chromecast.