Sana fonksiyonu ile akarsu yeteneği veren bu 3. parti uygulaması ile aynı şeyi yaşamış ve bunun için bir çözüm bulamadım ve sonra ben denedim elma yerli avplayer (avaudioplayer değil) :initWithURL
. ek olarak http://developer.apple.com/library/mac/#documentation/AVFoundation/Reference/AVPlayer_Class/Reference/Reference.html
burada müzik çalmak için benim kod:: Burada sınıf referans, bu arada
NSURL *url = [[NSURL alloc] initWithString:sourceURL];
theItem = [AVPlayerItem playerItemWithURL:url];
theItem addObserver:self forKeyPath:@"status" options:0 context:nil];
theAudio = [AVPlayer playerWithPlayerItem:mainDelegate.theItem];
oyuncu readyto Yukarıdaki gözlemciyi eklemek oynamak olup olmadığını yakalamak için ve sonra gibi kontrol edebilirsiniz :
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object
change:(NSDictionary *)change context:(void *)context {
if (object == theItem && [keyPath isEqualToString:@"status"]) {
if(theItem.status == AVPlayerStatusReadyToPlay)
{
[theAudio play];
[theItem removeObserver:self forKeyPath:@"status"];
}
else if(theItem.status == AVPlayerStatusFailed) {
NSLog(@"%@" , mainDelegate.theItem.error.description);
}
else if(theItem.status == AVPlayerStatusUnknown)
NSLog(@"unknown");
}
}
Umarım bu yardımcı olur.
Bu konuda paylaşabileceğiniz herhangi bir cevap var mı? –
İnternet bağlantısı olmadığında bu sorunu yaşadım. Bu bir faktör olabilir mi? Sizden ne zaman wifi'ye geçiyorsunuz? – Jensen2k