GCKMediaInformation initWithContentID是不推荐使用的警告

问题描述 投票:0回答:1

在建设GCKMediaInformation时我得到了这个警告:

'initWithContentID:streamType:contentType:metadata:streamDuration:mediaTracks:textTrackStyle:customData:'不推荐使用:使用GCKMediaInformationBuilder初始化GCKMediaInformation对象。

这是我的方法:

GCKMediaInformation* mediaInfo = [[GCKMediaInformation alloc]
    initWithContentID:[self.chromecastUrl absoluteString] // WARNING ON THIS LINE
           streamType:self.videoPlayer.isLive ? GCKMediaStreamTypeLive
                                              : GCKMediaStreamTypeBuffered
          contentType:@"application/dash+xml"
             metadata:metadata
       streamDuration:duration
          mediaTracks:nil
       textTrackStyle:nil
           customData:customData];

如何通过?

ios chromecast
1个回答
0
投票

以下是我通过使用GCKMediaInformationBuilder构建媒体信息来传递警告的方法:

GCKMediaInformationBuilder *builder =
[[GCKMediaInformationBuilder alloc] initWithContentURL:self.chromecastUrl];
builder.contentType = @"application/dash+xml";
builder.streamType = self.videoPlayer.isLive ? GCKMediaStreamTypeLive : GCKMediaStreamTypeBuffered;
builder.metadata = metadata;
builder.streamDuration = duration;
builder.customData = customData;
// set all other desired properties...

// then build the GCKMediaInformation with build method
GCKMediaInformation *mediaInfo = [builder build];

我希望这将有所帮助。

© www.soinside.com 2019 - 2024. All rights reserved.