Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introduction to New Cast SDK (v3) for iOS

Introduction to New Cast SDK (v3) for iOS

Daichi Furiya (Wasabeef)

September 02, 2016
Tweet

More Decks by Daichi Furiya (Wasabeef)

Other Decks in Programming

Transcript

  1. 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
  2. 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) }
  3. Recover from a temporary loss of WiFi Recover from device

    sleep Recover from backgrounding the app Recover if the app crashed Automatic Reconnection