iOS SDK Chromecast

Adding support for Chromecast

In order to enable chromecast, a few extra steps need to be taken. These steps are described below.

  1. Upgrade to the latest THEOplayer iOS SDK release (≥ 1.0.3)
  2. To add chromecast support the first thing you need is to include the Cast Framework. The following guide will help you adding the Cast Framework binary. (THEOplayer iOS SDK relies on Chromecast SDK version 3.5.6)

    Xcode 10 Warning: If developing using Xcode 10 and targeting iOS devices running iOS 12 or higher, the "Access WiFi Information" capability is required in order to discover and connect to Cast devices.
    https://developers.google.com/cast/docs/ios_sender_setup
  3. To enable chromecast on iOS the GCKCastContext shared instance should be set with a GCKCastOptions.
    let options = GCKCastOptions(receiverApplicationID: "A1B2C3D4")
    GCKCastContext.setSharedInstanceWith(options)
    or use the default THEOplayer cast options.
    THEOplayerCastHelper.setGCKCastContextSharedInstanceWithDefaultCastOptions()
  4. That 's it. When chromecast enabled devices are discovered, the player will display a chromecast button. The player also works nicely together with the Chromecast controls that are part of the Chromecast Framework, (e.g. GCKUICastButton or the mini controller).

 

FAQ: Can we use Chromecast SDK via Cocoapods?

YES.

You need to prepare your Podfile like this:

 
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'YourProjectTarget' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for YourProjectTarget
  pod 'google-cast-sdk', '~> 3.5.6'
end