I was trying to implement CAST SDK. My intension and i have done the following things :
- 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.
- I have bought Google Cast Developer Console with 5USD and created an applicationID there.
- I have integrated SDK and implement CAST button, set up all changes for iOS 14 in Plist and app capabilities.
- 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 :
- On first launch, app shows the cast button , i click on that, SDK displays permission alert/pop up, i accept all.
- After accepting permission , the cast button disappears and never seen to the app even i re-run the app.
- In the delegate method, i see a log : chromecast Message from Chromecast = Invalid network address
My queries is :
- Why the cast button disappears and never seen to the app , any solution ?
- Is it possible to share/mirroring the app screen rather playing videos using iOS CAST SDK ?
- 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
}
Related problem is here :
- https://github.com/googlecast/CastVideos-ios/issues/98
- https://issuetracker.google.com/issues/178424585
Anyone can help me on this ? Thanks in advance.