gpt4 book ai didi

ios - Chromecast 警告 loadMedia 自动播放已弃用

转载 作者:行者123 更新时间:2023-11-29 05:55:56 26 4
gpt4 key购买 nike

在我的 playSelectedItemRemotely 方法中,我收到一条警告消息:

 - (void)playSelectedItemRemotely {
GCKCastSession* castSession = [GCKCastContext sharedInstance].sessionManager.currentCastSession;
if (castSession) {
// WARNING ON LINE BELOW
[castSession.remoteMediaClient loadMedia:[self buildMediaInformation] autoplay:YES];
} else {
NSLog(@"No cast session!");
}
}

说:

'loadMedia:autoplay:' is deprecated: Use loadMedia:withOptions:

如何解决这个问题?

最佳答案

就像警告消息所说,您可以使用 loadMedia:withOptions 方法,如下所示:

- (void)playSelectedItemRemotely {
GCKCastSession* castSession = [GCKCastContext sharedInstance].sessionManager.currentCastSession;
if (castSession) {
GCKMediaLoadOptions *options = [GCKMediaLoadOptions init];
[castSession.remoteMediaClient loadMedia:[self buildMediaInformation] withOptions:options];
} else {
BILog(@"No cast session!");
}
}

以下是您可以使用的选项:

  • (BOOL) autoplay Whether playback should start immediately.

The default value is YES.

  • (NSTimeInterval) playPosition The initial playback position.

The default value is kGCKInvalidTimeInterval, which indicates a default playback position.

  • (float) playbackRate The playback rate.

The default value is 1.

  • (NSArray*) activeTrackIDs An array of integers specifying the active tracks.

The default value is nil.

  • (id) customData Custom application-specific data to pass along with the request.

Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil.

  • (NSString*) credentials

The user credentials for the media item being loaded.

  • (NSString*) credentialsType

The type of user credentials specified in GCKMediaLoadOptions::credentials.

另请检查the documentation .

关于ios - Chromecast 警告 loadMedia 自动播放已弃用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55155419/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com