Chromecast发送自定义数据ios

时间:2016-08-23 15:48:06

标签: android ios chromecast drm

在iOS中有这个API来发送customData

NSDictionary *customData = @{@"key": @"value"}
  GCKMediaInformation *mediaInformation = [[GCKMediaInformation alloc] initWithContentID:[url absoluteString]
                                                                                streamType:streamType
                                                                               contentType:@"movie"
                                                                                  metadata:metadata
                                                                            streamDuration:self.currentMedia.duration
                                                                            customData:customData];

这里的问题是customData的类型为id,我只能将它作为NSDictionary或JSON字符串传递。

MediaInfo mediaInfo =  mediaInfo = new MediaInfo.Builder(
                    resolvedUrl)
                    .setContentType("movie")
                    .setStreamType(MediaInfo.STREAM_TYPE_BUFFERED)
                    .setMetadata(mediaMetadata)
                    .setCustomData(program.getJSONObject())
                    .build();

在chromecast API中声明如下

public MediaInfo.Builder setCustomData(JSONObject customData)

但是在Android上,相同的API是CustomData是JSONObject,它可以正常工作。

在iOS上这样做是不可能的,所以如何在iOS中将customData作为JSONObject发送

0 个答案:

没有答案