I use QTKit to gradually download and play MP3s from a URL. According to this documentation , this is the code I should use for this:
NSURL *mp3URL = [NSURL URLWithString:@"http://foo.com/bar.mp3"];
NSError *error = nil;
QTMovie *sound = [[QTMovie alloc] initWithURL:mp3URL error:&error];
[sound play];
This works and does exactly what I want - the MP3 URL lazily loads and starts playing right away. However, if the URL does not have the extension ".mp3", it does not work:
NSURL *mp3URL = [NSURL URLWithString:@"http://foo.com/bar"];
NSError *error = nil;
QTMovie *sound = [[QTMovie alloc] initWithURL:mp3URL error:&error];
[sound play];
An error is not indicated, an exception does not occur; the duration of the sound is simply zero, and nothing is reproduced.
The only way I came across is to force the type to load data manually and use QTDataReference:
NSURL *mp3URL = [NSURL URLWithString:@"http://foo.com/bar"];
NSData *mp3Data = [NSData dataWithContentsOfURL:mp3URL];
QTDataReference *dataReference =
[QTDataReference dataReferenceWithReferenceToData:mp3Data
name:@"bar.mp3"
MIMEType:nil];
NSError *error = nil;
QTMovie *sound = [[QTMovie alloc] initWithDataReference:dataReference error:&error];
[sound play];
MP3 , , . ?
.
, , ; Content-Type HTTP-. , , - . - , ?
2
-? , Google ...