Slide 1

Slide 1 text

New Google Cast SDK for iOS wasabeef iOSDC Japan 2016

Slide 2

Slide 2 text

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

Slide 3

Slide 3 text

Chromecast http://www.google.co.jp/intl/ja_jp/chromecast

Slide 4

Slide 4 text

Google Cast SDK v3

Slide 5

Slide 5 text

Session state management Connect, disconnect, and reconnect logic UX implementation and UI Google Cast SDK v3

Slide 6

Slide 6 text

Sender

Slide 7

Slide 7 text

CocoaPods pod 'google-cast-sdk'

Slide 8

Slide 8 text

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

Slide 9

Slide 9 text

Add a Cast Button

Slide 10

Slide 10 text

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

Slide 11

Slide 11 text

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) }

Slide 12

Slide 12 text

Recover from a temporary loss of WiFi Recover from device sleep Recover from backgrounding the app Recover if the app crashed Automatic Reconnection

Slide 13

Slide 13 text

googlecast/ CastVideos-ios

Slide 14

Slide 14 text

Receiver

Slide 15

Slide 15 text

Google Cast SDK Developer Console

Slide 16

Slide 16 text

Default Media Receiver Custom Receiver Styled Media Receiver Receiver

Slide 17

Slide 17 text

Custom Receiver https://developers.google.com/cast/docs/custom_receiver

Slide 18

Slide 18 text

googlecast/ CastReferencePlayer

Slide 19

Slide 19 text

Conclusion

Slide 20

Slide 20 text

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