Introduction to New Cast SDK (v3) for iOS

Introduction to New Cast SDK (v3) for iOS


Daichi Furiya (Wasabeef)

September 02, 2016


  1. New Google Cast SDK for iOS wasabeef iOSDC Japan 2016

  2. About me Daichi Furiya Google Developer Expert AbemaTV, Inc. wasabeef

  3. Chromecast

  4. Google Cast SDK v3

  5. Session state management Connect, disconnect, and reconnect logic UX implementation

    and UI Google Cast SDK v3
  6. Sender

  7. CocoaPods pod 'google-cast-sdk'

  8. Initialize the Cast Context let options = GCKCastOptions(receiverApplicationID: “***D36F5”) GCKCastContext.setSharedInstanceWithOptions(options)

  9. Add a Cast Button

  10. Add a Cast Button let frame = CGRect(x: 0, y:

    0, width: 24, height: 24) let castButton = GCKUICastButton(frame: frame) castButton.tintColor = UIColor.whiteColor() let item = UIBarButtonItem(customView: castButton) self.navigationItem.rightBarButtonItem = item
  11. Load Media let meta = GCKMediaMetadata(metadataType: .Movie) meta.setString("わさビーフの奇妙な冒険 #1", forKey:

    kGCKMetadataKeyTitle) meta.setString("堅あげポテトは砕けない", forKey: kGCKMetadataKeySubtitle) meta.addImage( GCKImage(URL: NSURL(string: “")!, width: 480, height: 720)) let mediaInfo = GCKMediaInformation( contentID: "", streamType: .Buffered, contentType: "application/x-mpegurl", metadata: meta, streamDuration: 0, mediaTracks: [], textTrackStyle: nil, customData: nil ) if let session = GCKCastContext.sharedInstance().sessionManager.currentCastSession { session.remoteMediaClient.loadMedia(mediaInfo, autoplay: true) }
  12. Recover from a temporary loss of WiFi Recover from device

    sleep Recover from backgrounding the app Recover if the app crashed Automatic Reconnection
  13. googlecast/ CastVideos-ios

  14. Receiver

  15. Google Cast SDK Developer Console

  16. Default Media Receiver Custom Receiver Styled Media Receiver Receiver

  17. Custom Receiver

  18. googlecast/ CastReferencePlayer

  19. Conclusion

  20. Thank you.