#ios #chromecast
#iOS #chromecast
Вопрос:
При сборке 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];
как это передать?
Ответ №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()
Ответ №2:
Вот как я передаю это предупреждение, создавая информацию о носителе с помощью 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];
Я надеюсь, что это поможет.