An abstract base class representing a session with a receiver device.
More...
#import <GCKSession.h>
An abstract base class representing a session with a receiver device.
Subclasses must implement the start (GCKSession(Protected)) and endWithAction: (GCKSession(Protected)) methods, and must call the appropriate notifier methods (for example, notifyDidStartWithSessionID: (GCKSession(Protected))) to indicate corresponding changes in the session state. Subclasses may also implement setDeviceVolume: (GCKSession), setDeviceMuted: (GCKSession) and remoteMediaClient if the device supports such operations.
A session is created and controlled using the session methods in GCKSessionManager, which uses the appropriate GCKDeviceProvider to create the session, and then delegates session requests to that GCKSession object.
- Since
- 3.0
- (void) endWithAction: |
|
(GCKSessionEndAction) |
action |
|
Ends the session with the specified action.
This is an asynchronous operation. Must be overridden by subclasses.
- Parameters
-
action | The action to take when ending the session; see GCKSessionEndAction for more details. |
Provided by category GCKSession(Protected).
- (BOOL suspended) GCK_DEPRECATED |
|
("GCKSession no longer supports being in a suspended state. If) |
needed |
|
|
(move this functionality " "to a subclass.") |
|
|
|
| |
A flag indicating whether the session is currently suspended.
- Deprecated:
- GCKSession no longer supports being in suspended state. If needed, move this functionality to a subclass.
Provided by category GCKSession(Protected).
- (instancetype) initWithDevice: |
|
(GCKDevice *) |
device |
traits: |
|
(GCKSessionTraits *GCK_NULLABLE_TYPE) |
traits |
sessionID: |
|
(NSString *GCK_NULLABLE_TYPE) |
sessionID |
|
|
| |
Initializes a new session object for the given device, with default options.
- Parameters
-
device | The device. |
traits | The session traits. |
sessionID | The session ID of an existing session, if this object will be used to resume a session; otherwise nil if it will be used to start a new session. |
- (instancetype) initWithDevice: |
|
(GCKDevice *) |
device |
traits: |
|
(GCKSessionTraits *GCK_NULLABLE_TYPE) |
traits |
sessionID: |
|
(NSString *GCK_NULLABLE_TYPE) |
sessionID |
sessionOptions: |
|
(GCKSessionOptions *GCK_NULLABLE_TYPE) |
sessionOptions |
|
|
| |
Initializes a new session object for the given device.
- Parameters
-
device | The device. |
traits | The session traits. |
sessionID | The session ID of an existing session, if this object will be used to resume a session; otherwise nil if it will be used to start a new session. |
sessionOptions | The session options, if any; otherwise nil . |
- Since
- 4.0
- (void) notifyDidEndWithError: |
|
(NSError *GCK_NULLABLE_TYPE) |
error |
willTryToResume: |
|
(BOOL) |
willTryToResume |
|
|
| |
Called by subclasses to notify the framework that the session has ended.
- Parameters
-
error | The error that caused the session to end, if any. Should be nil if the session was ended intentionally. |
willTryToResume | Whether the session will try to resume itself automatically. |
Provided by category GCKSession(Protected).
- (void) notifyDidFailToStartWithError: |
|
(NSError *) |
error |
|
Called by subclasses to notify the framework that the session has failed to start.
- Parameters
-
error | The error that occurred. |
Provided by category GCKSession(Protected).
- (void) notifyDidReceiveDeviceStatus: |
|
(NSString *GCK_NULLABLE_TYPE) |
statusText |
|
Called by subclasses to notify the framework that updated status has been received from the device.
- Parameters
-
statusText | The new status. |
Provided by category GCKSession(Protected).
- (void) notifyDidReceiveDeviceVolume: |
|
(float) |
volume |
muted: |
|
(BOOL) |
muted |
|
|
| |
Called by subclasses to notify the framework that updated device volume and mute state has been received from the device.
- Parameters
-
volume | The device's current volume. Must be in the range [0, 1.0]; |
muted | The device's current mute state. |
Provided by category GCKSession(Protected).
- (void) notifyDidStartWithSessionID: |
|
(NSString *) |
sessionID |
|
Called by subclasses to notify the framework that the session has been started.
- Parameters
-
sessionID | The session's unique ID. |
Provided by category GCKSession(Protected).
- (void) notifyDidSuspendWithReason: |
|
("Do not call") |
GCK_DEPRECATED |
|
Sets the device's mute state.
This is an asynchronous operation. The default implementation is a no-op that fails the request with a GCKErrorCodeUnsupportedFeature error.
- Parameters
-
- Returns
- A GCKRequest object for tracking the request.
- Since
- 3.4; in previous framework versions, this method returned
void
.
Sets the device's volume.
This is an asynchronous operation. The default implementation is a no-op that fails the request with a GCKErrorCodeUnsupportedFeature error.
- Parameters
-
- Returns
- A GCKRequest object for tracking the request.
- Since
- 3.4; in previous framework versions, this method returned
void
.
Starts the session.
This is an asynchronous operation. Must be overridden by subclasses.
Provided by category GCKSession(Protected).
- (GCKConnectionState) connectionState |
|
readnonatomicassign |
The current session connection state.
- (BOOL) currentDeviceMuted |
|
readnonatomicassign |
The current device mute state.
- (float) currentDeviceVolume |
|
readnonatomicassign |
The current device volume, in the range [0.0, 1.0].
The device that this session is associated with.
- (NSString*) deviceStatusText |
|
readnonatomiccopy |
The current device status text.
The current media metadata, if any.
Will be nil
if the session does not support the media namespace or if no media is currently loaded on the receiver.
The current session ID, if any.
- (GCKSessionOptions*) sessionOptions |
|
readnonatomicstrong |
The session options, if any.
- Since
- 4.0
The documentation for this class was generated from the following file: