3

I was trying to implement CAST SDK. My intension and i have done the following things :

  1. Casting/Mirroring my app screen. I don't want to play any video , just screen casting of my app to larger TV/screen. I know about Airplay, please discuss on Google SDK now.
  2. I have bought Google Cast Developer Console with 5USD and created an applicationID there.
  3. I have integrated SDK and implement CAST button, set up all changes for iOS 14 in Plist and app capabilities.
  4. I have changed all these and found all alert of permission as well : https://developers.google.com/cast/docs/ios_sender/ios_permissions_changes

The problem i am facing now :

  1. On first launch, app shows the cast button , i click on that, SDK displays permission alert/pop up, i accept all.
  2. After accepting permission , the cast button disappears and never seen to the app even i re-run the app.
  3. In the delegate method, i see a log : chromecast Message from Chromecast = Invalid network address

My queries is :

  1. Why the cast button disappears and never seen to the app , any solution ?
  2. Is it possible to share/mirroring the app screen rather playing videos using iOS CAST SDK ?
  3. To share screen , do i need to use any other class/API from SDK ? I see no good example on this, seems poor support from the team.

My code is simple here like :

 // Appdelegate 
 class AppDelegate: UIResponder, UIApplicationDelegate, GCKLoggerDelegate {

let kReceiverAppID = kGCKDefaultMediaReceiverApplicationID
let kDebugLoggingEnabled = true
private let appId = "EF819***"

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    
 
    
    let discoveryCriteria = GCKDiscoveryCriteria(applicationID: appId)
    let castOptions = GCKCastOptions(discoveryCriteria: discoveryCriteria)
    GCKCastContext.setSharedInstanceWith(castOptions)
    GCKLogger.sharedInstance().delegate = self

    return true
}

     func logMessage(_ message: String, at level: GCKLoggerLevel, fromFunction function: String, location: String) {
    //  print("Message from Chromecast = \(message)")
}

// In ViewController , imported CASTSDK

  override func viewDidLoad() {
    super.viewDidLoad()

    // Do any additional setup after loading the view.
    let castButton = GCKUICastButton(frame: CGRect(x: 0, y: 0, width: 24, height: 24))
    castButton.tintColor = UIColor.gray
    navigationItem.rightBarButtonItem = UIBarButtonItem(customView: castButton)
    self.view.backgroundColor = .white
}

The app settings is : enter image description here

Related problem is here :

  1. https://github.com/googlecast/CastVideos-ios/issues/98
  2. https://issuetracker.google.com/issues/178424585

Anyone can help me on this ? Thanks in advance.

0

1 Answer 1

0

My best bet would be that either number 2 or 3 from the upgrade docs are malformed.

  1. Add NSBonjourServices to your Info.plist (make sure you have an underscore(_) before your appId/receiverID from here
<key>NSBonjourServices</key>
<array>
  <string>_googlecast._tcp</string>
  <string>_ABCD1234._googlecast._tcp</string>
</array>
  1. Add NSLocalNetworkUsageDescription to your Info.plist
<key>NSLocalNetworkUsageDescription</key>
<string>${PRODUCT_NAME} uses the local network to discover Cast-enabled devices on your WiFi
network.</string>
2

Not the answer you're looking for? Browse other questions tagged or ask your own question.