googlecast / CastVideos-ios

Reference iOS Sender w/ Framework API: CastVideos-ios application shows how to cast videos from an iOS device that is fully compliant with the Cast Design Checklist.
Apache License 2.0
193 stars 63 forks source link

Cannot connect with devices to cast videos swift #123

Open shmiftari opened 2 years ago

shmiftari commented 2 years ago

Hello, Im trying to cast video but no success the error is showing: No devices available Make sure Local Network Access is on(But i gave access also in AppPrivacy->LNE is ON, also im in the same wi-fi network with TV

My code in Appdelegate.swift let options = GCKCastOptions(discoveryCriteria: GCKDiscoveryCriteria(applicationID: kReceiverAppID)) options.physicalVolumeButtonsWillControlDeviceVolume = true

/** Following code enables CastConnect */
let launchOptions = GCKLaunchOptions()
launchOptions.androidReceiverCompatible = true
options.launchOptions = launchOptions

GCKCastContext.setSharedInstanceWith(options)

Also in ViewController.swift castButton = GCKUICastButton(frame: CGRect(x: CGFloat(0), y: CGFloat(0), width: CGFloat(24), height: CGFloat(24))) // Overwrite the UIAppearance theme in the AppDelegate. castButton.tintColor = UIColor.white navigationItem.rightBarButtonItem = UIBarButtonItem(customView: castButton)

In info.plist i added:

NSBluetoothAlwaysUsageDescription
<string>${PRODUCT_NAME} uses Bluetooth to discover nearby devices.</string>
<key>NSBonjourServices</key>
<array>
    <string>_googlecast._tcp</string>
    <string>_C0868879._googlecast._tcp</string>
</array>
<key>NSLocalNetworkUsageDescription</key>
<string>${PRODUCT_NAME} uses the local network to discover Cast-enabled devices on your WiFi network.</string>

Can someone let me know if someone has the same issue and what can i do?

Thank you

shmiftari commented 2 years ago

Also i will attach screenshot ![Screenshot 2022-10-26 at 3 13 20 PM](https://user-images.githubusercontent.com/25005908/198035163-9aaf700d-63f2-42f7-9bf9-951f00c71ac8. Screenshot 2022-10-26 at 3 13 04 PM png) Screenshot 2022-10-26 at 3 12 47 PM