Chromecast integration

This article describes how to integrate the Wowza Flowplayer SDK with the Google Cast SDK, to show and control media on a Google Cast device. The instructions assume you have installed the Wowza Flowplayer SDK and its dependencies in your app.

Download the SDK

You can download the SDK through CocoaPods or manually.

CocoaPods

Add FlowplayerChromecast together with its dependencies in your Podfile:

Copy
Copied
pod 'Flowplayer', '~> 3.0.3' # required
pod 'FlowplayerChromecast', '~> 3.0.3'

Execute pod install and you're ready to go.

info
  • Use Google Cast iOS SDK version 4.7.0 or above
  • Use Flowplayer version 3.0.3 or above

Manually

Download the XC framework of Wowza Flowplayer Chromecast iOS SDK from here.

Only for Apple Silicon and CocoaPods

If you have arm64 excluded as a valid architecture for Simulators, add the following code at the bottom of your Podfile file so that Protobuf, a dependency of Google Cast, can compile.

Copy
Copied
post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
			# Disable arm64 arch for Protobuf :(
			# As of writing this most dep. are x86_64 compiled and not arm64. 03.02.2022
      if target.name == "Protobuf"
        if config.name == "Debug"
					config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
        end
      end
    end
  end
end

Add Google Cast to your project

Follow the instructions for how to add the Google Cast SDK to your project (Develop iOS Sender App: Setup). This involves adding the Cast SDK, either manually or via third-party dependency managers like CocoaPods, and all its dependencies. Also, don't forget to add the desired capabilities in your Xcode project.

How to use a custom Google Cast receiver app

If you have your own Cast receiver app, you can set the app id in your iOS app's Info.plist using the key FlowplayerCastReceiverAppId. If not set, the Wowza Flowplayer SDK will use Wowza Flowplayer's default Cast receiver app.

Starting the manager

Early on in your app's startup process, you need to start the FPCastManager. The Wowza Flowplayer cast manager will, in turn, start the Google Cast context provided by the Google Cast SDK.

Your app delegate's application:didFinishLaunchingWithOptions: is a good place to start the cast manager:

Copy
Copied
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

    // Start the cast manager.
    FPCastManager.shared.start()

    return true
}

Add cast button

Please follow the Google Cast instructions to add a Cast button.