We are creating a video app with React Native and we are using react-native-google-cast to cast videos to a ChromeCast, but we are running into some problems. When clicking the ChromeCast button in the app on iOS, it says No devices found. We tried to debug and found the follow:
- The ChromeCast can be found and connected with an Android device.
- The ChromeCast can be found on an iOS emulator. Just not with a physical device.
- Location permissions are turned on for the physical device.
- Other apps like Netflix have no problems finding and connecting to the ChromeCast.
- In Xcode, Access Wifi Information is added to Signing & Capabilities.
- Added NSBonjourServices to Info.plist (as seen below)
- Added piece of code to AppDelegate.m
Code in Info.plist
<key>NSBonjourServices</key>
<array>
<string>_googlecast._tcp</string>
<string>_myapp._googlecast._tcp</string>
</array>
<key>NSLocalNetworkUsageDescription</key>
<string>${PRODUCT_NAME} uses the local network to discover Cast-enabled devices on your WiFi network.</string>
Code in AppDelegate.m
// Google cast
NSString *receiverAppID = @"B67DFE6D"; // kGCKDefaultMediaReceiverApplicationID or @"ABCD1234"
GCKDiscoveryCriteria *criteria = [[GCKDiscoveryCriteria alloc] initWithApplicationID:receiverAppID];
GCKCastOptions* options = [[GCKCastOptions alloc] initWithDiscoveryCriteria:criteria];
[GCKCastContext setSharedInstanceWithOptions:options];
Does anyone have any idea what could be the problem?