在建造GCKMediaInformation时,我收到此警告:
'initWithContentID:streamType:contentType:元数据: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];
如何通过?
答案 0 :(得分:1)
万一有人在寻找Swift版本,就在这里。
let builder = GCKMediaInformationBuilder()
builder.contentType = "application/dash+xml"
builder.streamType = self.videoPlayer.isLive ? .live : .buffered
builder.metadata = metadata
builder.streamDuration = duration
builder.customData = customData
// set all other desired properties...
// then build the GCKMediaInformation with build method
let mediaInfo = builder.build()
答案 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];
我希望这会有所帮助。