GCKCastContext Class

GCKCastContext Class Reference

Overview

A class containing global objects and state for the framework.

The context must be initialized early in the application's lifecycle via a call to setSharedInstanceWithOptions: (GCKCastContext).

Since
3.0

Inherits NSObject.

Instance Method Summary

(void) - registerDeviceProvider:
 Registers a device provider, which adds support for a new type of (non-Cast) device. More...
 
(void) - unregisterDeviceProviderForCategory:
 Unregisters the device provider for a given device category. More...
 
(void) - presentCastDialog
 Displays the Cast dialog. More...
 
(GCKUICastContainerViewController *) - createCastContainerControllerForViewController:
 Constructs a GCKUICastContainerViewController that embeds the given view controller. More...
 
(GCKUIMiniMediaControlsViewController *) - createMiniMediaControlsViewController
 Constructs a GCKUIMiniMediaControlsViewController. More...
 
(BOOL) - presentCastInstructionsViewControllerOnce
 If it has not been shown before, presents a fullscreen modal view controller that calls attention to the Cast button and displays some brief instructional text about its use. More...
 
(void) - clearCastInstructionsShownFlag
 Clears the persistent flag that tracks whether the Cast instructions modal view controller has been shown. More...
 
(void) - presentDefaultExpandedMediaControls
 Displays the default Cast expanded media controls. More...
 

Class Method Summary

(void) + setSharedInstanceWithOptions:
 Sets the shared instance, supplying a Cast options object. More...
 
(instancetype) + sharedInstance
 Returns the singleton instance. More...
 
(BOOL) + isSharedInstanceInitialized
 Tests if the singleton instance has been initialized yet. More...
 

Public Attributes

NSString *const kGCKNotificationKeyCastState
 The userInfo key for the new Cast state in a Cast state change notification. More...
 
NSString *const kGCKCastStateDidChangeNotification
 The name of the notification that will be published when the Cast state changes. More...
 
NSString *const kGCKUICastDialogWillShowNotification
 The name of the notification that will be published when the Cast dialog is about to be shown. More...
 
NSString *const kGCKUICastDialogDidHideNotification
 The name of the notification that will be published when the Cast dialog has been dismissed. More...
 

Property Summary

GCKCastState castState
 The current casting state for the application. More...
 
GCKDiscoveryManagerdiscoveryManager
 The discovery manager. More...
 
GCKSessionManagersessionManager
 The session manager. More...
 
id< GCKUIImageCacheimageCache
 The image cache implementation that will be used by the framework to fetch images that are referenced in media metadata. More...
 
id< GCKUIImagePickerimagePicker
 The image picker implementation that will be used to select an image for a specific purpose. More...
 
BOOL useDefaultExpandedMediaControls
 Configures the behavior of the Framework when there's a user action that should result in the presentation of the expanded controls. More...
 
GCKUIExpandedMediaControlsViewControllerdefaultExpandedMediaControlsViewController
 The instance of the default Cast expanded media controls view controller. More...
 

Method Detail

+ (void) setSharedInstanceWithOptions: (GCKCastOptions *)  options

Sets the shared instance, supplying a Cast options object.

If the shared instance is already initialized, an exception will be thrown. This method must be called on the main thread.

+ (instancetype) sharedInstance

Returns the singleton instance.

If a shared instance has not yet been initialized, an exception will be thrown.

+ (BOOL) isSharedInstanceInitialized

Tests if the singleton instance has been initialized yet.

Since
3.5.4
- (void) registerDeviceProvider: (GCKDeviceProvider *)  deviceProvider

Registers a device provider, which adds support for a new type of (non-Cast) device.

Parameters
deviceProviderAn instance of a GCKDeviceProvider subclass for managing the devices.
- (void) unregisterDeviceProviderForCategory: (NSString *)  category

Unregisters the device provider for a given device category.

Parameters
categoryA string that uniquely identifies the type of device.
- (void) presentCastDialog

Displays the Cast dialog.

Provided by category GCKCastContext(UI).

- (GCKUICastContainerViewController *) createCastContainerControllerForViewController: (UIViewController *)  viewController

Constructs a GCKUICastContainerViewController that embeds the given view controller.

Provided by category GCKCastContext(UI).

- (GCKUIMiniMediaControlsViewController *) createMiniMediaControlsViewController

Constructs a GCKUIMiniMediaControlsViewController.

Provided by category GCKCastContext(UI).

- (BOOL) presentCastInstructionsViewControllerOnce

If it has not been shown before, presents a fullscreen modal view controller that calls attention to the Cast button and displays some brief instructional text about its use.

Returns
YES if the view controller was shown, NO if it was not shown because it had already been shown before.

Provided by category GCKCastContext(UI).

- (void) clearCastInstructionsShownFlag

Clears the persistent flag that tracks whether the Cast instructions modal view controller has been shown.

Provided by category GCKCastContext(UI).

- (void) presentDefaultExpandedMediaControls

Displays the default Cast expanded media controls.

Provided by category GCKCastContext(UI).

Member Data Documentation

- (NSString* const) kGCKNotificationKeyCastState

The userInfo key for the new Cast state in a Cast state change notification.

- (NSString* const) kGCKCastStateDidChangeNotification

The name of the notification that will be published when the Cast state changes.

- (NSString* const) kGCKUICastDialogWillShowNotification

The name of the notification that will be published when the Cast dialog is about to be shown.

Since
3.4
- (NSString* const) kGCKUICastDialogDidHideNotification

The name of the notification that will be published when the Cast dialog has been dismissed.

Since
3.4

Property Detail

- (GCKCastState) castState
readnonatomicassign

The current casting state for the application.

Changes to this property can be monitored with KVO or by listening for kGCKCastStateDidChangeNotification notifications.

- (GCKDiscoveryManager*) discoveryManager
readnonatomicstrong

The discovery manager.

This object handles the discovery of receiver devices.

- (GCKSessionManager*) sessionManager
readnonatomicstrong

The session manager.

This object manages the interaction with receiver devices.

- (id<GCKUIImageCache>) imageCache
readwritenonatomicstrong

The image cache implementation that will be used by the framework to fetch images that are referenced in media metadata.

A default implementation will be used if one is not provided by the application. May be set to nil to reinstate the default image cache.

Provided by category GCKCastContext(UI).

- (id<GCKUIImagePicker>) imagePicker
readwritenonatomicstrong

The image picker implementation that will be used to select an image for a specific purpose.

A default implementation will be used if one is not provided by the application. May be set to nil to reinstate the default image picker.

Provided by category GCKCastContext(UI).

- (BOOL) useDefaultExpandedMediaControls
readwritenonatomicassign

Configures the behavior of the Framework when there's a user action that should result in the presentation of the expanded controls.

If YES, the Framework will present the default expaned controls view. If NO, the Framework will just trigger a GCKUICastContainerViewController::kGCKExpandedMediaControlsTriggeredNotification.

Provided by category GCKCastContext(UI).

- (GCKUIExpandedMediaControlsViewController*) defaultExpandedMediaControlsViewController
readnonatomicstrong

The instance of the default Cast expanded media controls view controller.

Provided by category GCKCastContext(UI).