Introduction to New Cast SDK (v3) for iOS

Introduction to New Cast SDK (v3) for iOS

6dd0483f1353a4a359e92633cfd65c64?s=128

Daichi Furiya (Wasabeef)

September 02, 2016
Tweet

Transcript

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

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

    @wasabeef_jp
  3. Chromecast http://www.google.co.jp/intl/ja_jp/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: “https://wasabeef.jp/cover.webp")!, width: 480, height: 720)) let mediaInfo = GCKMediaInformation( contentID: "https://wasabeef.jp/jojo-anim.m3u8", 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 https://developers.google.com/cast/docs/custom_receiver

  18. googlecast/ CastReferencePlayer

  19. Conclusion

  20. Thank you. twitter.com/wasabeef_jp wasabeef.jp github.com/wasabeef