我从设备iTunes库中获取一首歌并将其推入AVAsset:
- (void)mediaPicker: (MPMediaPickerController *)mediaPicker didPickMediaItems:(MPMediaItemCollection *)mediaItemCollection
{
NSArray *arr = mediaItemCollection.items;
MPMediaItem *song = [arr objectAtIndex:0];
NSData *songData = [NSData dataWithContentsOfURL:[song valueForProperty:MPMediaItemPropertyAssetURL]];
}
Run Code Online (Sandbox Code Playgroud)
然后我有这个Game Center方法来接收数据:
- (void)match:(GKMatch *)match didReceiveData:(NSData *)data fromPlayer:(NSString *)playerID
Run Code Online (Sandbox Code Playgroud)
我很难找到如何通过GameCenter发送这个AVAsset然后让它在接收设备上播放.
我读过:http: //developer.apple.com/library/ios/#documentation/MusicAudio/Reference/AudioStreamReference/Reference/reference.html#//apple_ref/doc/uid/TP40006162
我迷失了.信息超载.
我已经实现了Cocoa With Love的音频流代码,但我无法弄清楚如何通过GameCenter获取我收到的NSData并将其推送到他的代码中. http://cocoawithlove.com/2008/09/streaming-and-playing-live-mp3-stream.html
有人可以帮我解决这个问题吗?因此,我需要帮助的部分只是简单地将歌曲数据分解成数据包(或者它可以工作),然后迭代这些数据包并通过游戏套件发送它,然后解析它在接收设备上传入的数据作为播放它它进来了.