GCKSession 类
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
此类继承 NSObject。
由 GCKCastSession 继承。
- (instancetype) initWithDevice: |
|
(GCKDevice *) |
device |
traits: |
|
(nullable GCKSessionTraits *) |
traits |
sessionID: |
|
(nullable NSString *) |
sessionID |
|
|
| |
使用默认选项为指定设备初始化新的会话对象。
- 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: |
|
(nullable GCKSessionTraits *) |
traits |
sessionID: |
|
(nullable NSString *) |
sessionID |
sessionOptions: |
|
(nullable GCKSessionOptions *) |
sessionOptions |
|
|
| |
为指定设备初始化新的会话对象。
- 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 . |
- 开始时间
- 4.0
设置设备的音量。
这是一项异步操作。默认实现是一个空操作,该操作会使请求失败并显示 GCKErrorCodeUnsupportedFeature 错误。
- Parameters
-
- 返回
- 一个用于跟踪请求的 GCKRequest 对象。
- 开始时间
- 3.4;在之前的框架版本中,此方法返回
void
。
设置设备的静音状态。
这是一项异步操作。默认实现是一个空操作,该操作会使请求失败并显示 GCKErrorCodeUnsupportedFeature 错误。
- Parameters
-
- 返回
- 一个用于跟踪请求的 GCKRequest 对象。
- 开始时间
- 3.4;在之前的框架版本中,此方法返回
void
。
结束具有指定操作的会话。
这是一项异步操作。必须被子类替换。
- Parameters
-
action | The action to take when ending the session; see GCKSessionEndAction for more details. |
由“GCKSession(Protected)”类别提供。
- (void) notifyDidStartWithSessionID: |
|
(NSString *) |
sessionID |
|
- (void) notifyDidFailToStartWithError: |
|
(GCKError *) |
error |
|
- (void) notifyDidEndWithError: |
|
(nullable NSError *) |
error |
willTryToResume: |
|
(BOOL) |
willTryToResume |
|
|
| |
由子类调用,以通知框架会话已结束。
- 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. |
由“GCKSession(Protected)”类别提供。
- (void) notifyDidReceiveDeviceVolume: |
|
(float) |
volume |
muted: |
|
(BOOL) |
muted |
|
|
| |
由子类调用,以通知框架已从设备收到更新后的设备音量和静音状态。
- Parameters
-
volume | The device's current volume. Must be in the range [0, 1.0]; |
muted | The device's current mute state. |
由“GCKSession(Protected)”类别提供。
- (void) notifyDidReceiveDeviceStatus: |
|
(nullable NSString *) |
statusText |
|
- (GCKSessionOptions*) sessionOptions |
|
readnonatomicstrong |
- (GCKConnectionState) connectionState |
|
readnonatomicassign |
- (NSString*) deviceStatusText |
|
readnonatomiccopy |
- (float) currentDeviceVolume |
|
readnonatomicassign |
- (BOOL) currentDeviceMuted |
|
readnonatomicassign |
当前媒体元数据(如果有)。
如果会话不支持媒体命名空间或接收器上当前未加载任何媒体,则值为 nil
。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2023-12-02。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2023-12-02。"],[[["`GCKSession` is an abstract base class representing a session with a receiver device, requiring subclasses to implement `start` and `endWithAction` methods."],["Subclasses must also call specific notifier methods to indicate changes in the session state and can implement methods for device volume, mute state, and remote media client if supported by the device."],["Sessions are created and managed by `GCKSessionManager`, which utilizes `GCKDeviceProvider` for device discovery and delegates session requests to the `GCKSession` object."],["Key properties of `GCKSession` include the associated device, session ID, connection state, device status, and optional remote media client for controlling media playback."],["Subclasses like `GCKCastSession` inherit from `GCKSession` and provide concrete implementations for specific Cast sessions."]]],[]]