AI-generated Key Takeaways
-
GCKCastContext is a class holding global objects and state for the framework, requiring early initialization via
setSharedInstanceWithOptions:. -
You can register and unregister device providers to support different device types.
-
The class provides methods to present the Cast dialog, create view controllers for UI components like cast containers and mini media controls, and manage instructional views.
-
It includes properties to access the current casting state, discovery manager, session manager, and image handling objects.
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... | |
| GCKDiscoveryManager * | discoveryManager |
| The discovery manager. More... | |
| GCKSessionManager * | sessionManager |
| The session manager. More... | |
| id< GCKUIImageCache > | imageCache |
| The image cache implementation that will be used by the framework to fetch images that are referenced in media metadata. More... | |
| id< GCKUIImagePicker > | imagePicker |
| 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... | |
| GCKUIExpandedMediaControlsViewController * | defaultExpandedMediaControlsViewController |
| 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
-
deviceProvider An instance of a GCKDeviceProvider subclass for managing the devices.
| - (void) unregisterDeviceProviderForCategory: | (NSString *) | category |
Unregisters the device provider for a given device category.
- Parameters
-
category A 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
YESif the view controller was shown,NOif 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
|
readnonatomicassign |
The current casting state for the application.
Changes to this property can be monitored with KVO or by listening for kGCKCastStateDidChangeNotification notifications.
|
readnonatomicstrong |
The discovery manager.
This object handles the discovery of receiver devices.
|
readnonatomicstrong |
The session manager.
This object manages the interaction with receiver devices.
|
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).
|
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).
|
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).
|
readnonatomicstrong |
The instance of the default Cast expanded media controls view controller.
Provided by category GCKCastContext(UI).