简体   繁体   中英

Streaming audio from Parse.com – no data retrieved?

I am attempting to use Parse.com's data service to stream a set of audio files to an iOS app that I'm developing. Unfortunately, I'm running into a problem retrieving the data using Parse's API – the data that I retrieve, whether I attempt to stream it or not, always has a size of 0 bytes.

I am currently retrieving the PFObject using its ObjectID, retrieving the object audio file as a PFFile, and converting the file to a URL to be loaded into an audio player for streaming. The debugger reveals that the PFFile has a file size of zero bytes, however, and so the URL probably also points to nothing.

Querying Parse using a callback routine:

PFQuery *query = [PFQuery queryWithClassName:@"StopAudio"];
[query getObjectInBackgroundWithId:[newStop objectID]
                          target:self
                          selector:@selector(retrieveTourDataCallback:error:)];

Using the PFObject produced by the query:

PFFile *audioFile = stopAudioObject[@"audioFile"];
NSString *filePath = [audioFile url];
[audioPlayer loadPlayerWith:[NSURL URLWithString:filePath]];

The audioPlayer object is a wrapper around an AVPlayer object.

Is there someway that I could stream this data or at least retrieve it from Parse in some other way?

The problem that I was experiencing has mysteriously disappeared and I'm at a loss for what could have caused it. Although I might have received 0-bytes if there was an issue with the network on the machine that I was running the simulator on, no errors were logged.

But it does work. Another X-File, I suppose.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM