avqueueplayer

Detecting Current Item in AVQueuePlayer and Knowing when it Changes?

岁酱吖の 提交于 2019-12-12 13:50:10
问题 I currently have an AVQueuePlayer playing a few .aif files in sequence. As it goes through each audio I want to perform an action related to that specific sound (for example changing an imageview's uiimage). My problem is setting the NSNotification correctly. I've set it to notify me when the queue finished with the last object, but I'm having trouble receiving an a notification for each current item. Here is what I have: //Setting Up My Queue List yellowVoice = [[AVPlayerItem alloc]

AVQueuePlayer playing several audio tracks in background iOS5

强颜欢笑 提交于 2019-12-12 09:18:55
问题 I used AVQueuePlayer to play several items in background. And code worked perfect in iOS4. And in iOS5 AVQueuePlayer changed its behavior, so player stops playing after first item is ended. Matt Gallagher wrote a hint in this post. "As of iOS 5, it appears that AVQueuePlayer no longer pre-buffers. It did pre-buffer the next track in iOS 4." So my question is how to play several items in background using AVPlayer or AVQueuePlayer in iOS5. 回答1: Matt Gallagher's answer in his blog: "You must

AVPlayerItemDidPlayToEndTimeNotification only works if forced

♀尐吖头ヾ 提交于 2019-12-10 11:56:20
问题 I been searching everywhere and I still can't find a solution to this problem. I have a AVQueuePlayer for a radio app that I am making. It has about 20 AVPlayerItems queued at a time. I added the AVPlayerItemDidPlayToEndTimeNotification observer to each one of those items. The notification gets fired and executes the code to remove key observers for metadata and status so it doesn't crash and advances to next item in the queue. However it doesn't want to play. There is no error, the status is

AVQueuePlayer frustrations (buffer underrun handling)

允我心安 提交于 2019-12-10 10:22:54
问题 I am having a hell of a time with AVQueuePlayer. Very simply, I am making it on an array of AVPlayerItems built with playerItemWithURL: and pointing to video assets on a server out on the Net. If I try to run this thing in the stimulator (sic) it plays through the first asset, begins playing the second and just dies. Sometimes it doesn't even get through the first asset. Now, I understand that the sim behaves differently than the device, so I tried it on the device as well, with the same

iOS xcode4 AVQueuePlayer not playing sound

。_饼干妹妹 提交于 2019-12-08 09:56:54
问题 I'm trying to play a .m4a sound file using AVQueuePlayer, on iPhone4, but there is no sound. If I try AudioServicesPlaySystemSound with the same file, all works okay. Here's the code. (AVFoundation framework is installed.) #import <AVFoundation/AVFoundation.h> -(void) play_sound_file: (NSString *) sound_file_m4a { printf("\n play_sound_file 1: '%s' ", [sound_file_m4a UTF8String] ); AVPlayerItem *sound_file = [[AVPlayerItem alloc] initWithURL:[NSURL URLWithString:[[NSBundle mainBundle]

How to do something when AVQueuePlayer finishes the last playeritem

﹥>﹥吖頭↗ 提交于 2019-12-07 03:37:30
问题 I've got an AVQueuePlayer which I'm creating from an array of 4 AVPlayerItems, and it all plays fine. I want to do something when the last item in the queue finishes playing, I've looked a load of answers on here and this is the one that looks most promising for what I want: The best way to execute code AFTER a sound has finished playing In my button handler i have this code: static const NSString *ItemStatusContext; [thePlayerItemA addObserver:self forKeyPath:@"status" options:0 context:

Memory leak from looping SKVideoNode (only on actual device)

梦想与她 提交于 2019-12-06 15:01:07
问题 I have a memory leak that I cannot diagnose. I have tried multiple approaches to creating a seamlessly looped video - Besides AVPlayerLooper, all of the approaches I've encountered and tried involve creating an observer to watch AVPlayerItemDidPlayToEndTimeNotification and then either seeking to the beginning of the video (in the case of AVPlayer) or inserting the video to be looped into the video queue (in the case of AVQueuePlayer). Both seem to have similar performance, but both also have

How to do something when AVQueuePlayer finishes the last playeritem

北战南征 提交于 2019-12-05 06:18:46
I've got an AVQueuePlayer which I'm creating from an array of 4 AVPlayerItems, and it all plays fine. I want to do something when the last item in the queue finishes playing, I've looked a load of answers on here and this is the one that looks most promising for what I want: The best way to execute code AFTER a sound has finished playing In my button handler i have this code: static const NSString *ItemStatusContext; [thePlayerItemA addObserver:self forKeyPath:@"status" options:0 context:&ItemStatusContext]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector

How to start next a Song or recognized that a song is finished while playing with AVPlayer?

最后都变了- 提交于 2019-12-04 18:28:12
How can I start next song immediately with AVPlayer? I have collections of song selected from iPod Library in MPMediaItemCollection . Now how can i use AVPlayer for lists of songs to be played one by one?? Janak Nirmal For answer to your first question, You can use Notification for the same as [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(songFinished:) name:AVPlayerItemDidPlayToEndTimeNotification object:[yourAVPlayer currentItem]]; -(void)songFinished:(NSNotification *)notification { //Do your next stuff here; } 来源: https://stackoverflow.com/questions/7386726/how

AVQueuePlayer playing several audio tracks in background iOS5

回眸只為那壹抹淺笑 提交于 2019-12-04 18:27:55
I used AVQueuePlayer to play several items in background. And code worked perfect in iOS4. And in iOS5 AVQueuePlayer changed its behavior, so player stops playing after first item is ended. Matt Gallagher wrote a hint in this post . "As of iOS 5, it appears that AVQueuePlayer no longer pre-buffers. It did pre-buffer the next track in iOS 4." So my question is how to play several items in background using AVPlayer or AVQueuePlayer in iOS5. Matt Gallagher's answer in his blog : "You must observe the current item in the AVQueuePlayer. When it changes, you must use UIApplication to start a