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. 6.
  2. 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
  3. 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) }
  4. 12.

    Recover from a temporary loss of WiFi Recover from device

    sleep Recover from backgrounding the app Recover if the app crashed Automatic Reconnection
  5. 14.