在2.5.0中使用Cordova媒体对象的Soundcloud流媒体



我正在使用IOS中引用的Cordova媒体对象:

http://cordova.apache.org/docs/en/2.5.0/cordova_media_media.md.html媒体

在android设备上,它可以完美地工作,在几秒钟内加载。但在IOS设备上,有时需要一分钟以上的时间。接下来,我的设备变得几乎没有响应。

在控制台中,我得到这个通知:

 void SendDelegateMessage(NSInvocation *): delegate (webView:resource:didFinishLoadingFromDataSource:) failed to return after waiting 10 seconds. main run loop mode: kCFRunLoopDefaultMode

我提到过它不是真正的流媒体,而只是将完整的文件加载到设备上。有办法解决这个问题吗?使用Cordova 2.5.0

发生的事情是cordova,在运行它之前先下载文件,我所做的是改变(CDVSound.m)的方法prepareToPlay,使用NSURLConnection下载文件并运行CFRunLoopRun(),这允许我向用户显示加载图标,没有解决问题,但我为我工作。

NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:request delegate:self];
if (theConnection) {
  receivedData = [NSMutableData data];
  CFRunLoopRun();
} else {
 // Inform the user that the connection failed.
 }

- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
  // This returns control to wherever you called
  // CFRunLoopRun() from, so you can still clean up
  // or do other interesting things.
    NSLog(@"Termina de cargar...");
    CFRunLoopStop(CFRunLoopGetCurrent());
 }
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {
    NSLog(@"Error: %@", error);
    CFRunLoopStop(CFRunLoopGetCurrent());
  }

最新更新