The status of AudioSteamer sometimes does not change in AS_PLAYING

I use Matt Gallagher AudioSteamer to implement the online music playback function, I found that online music sometimes plays, but the status of the audiostreamer does not change to AS_PLAYING, does anyone encounter the same problem? Can you tell me how to resolve the issue ~~ thanks ~

I think one of the reasons is this:

if (![[NSThread currentThread] isEqual:internalThread]) { [self performSelector:@selector(handlePropertyChange:) onThread:internalThread withObject:[NSNumber numberWithInt:inID] waitUntilDone:NO modes:[NSArray arrayWithObject:NSDefaultRunLoopMode]]; return; } 

after executing this code in

 - (void)handlePropertyChangeForQueue:(AudioQueueRef)inAQ propertyID:(AudioQueuePropertyID)inID 

function:

 - (void)handlePropertyChange:(NSNumber *)num { [self handlePropertyChangeForQueue:NULL propertyID:[num intValue]]; } 

not running ... I really don't know how to fix this ... does anyone help me? thanks..

+4
source share
1 answer

I also have this problem. I added this code:

 if (state == AS_WAITING_FOR_QUEUE_TO_START){ @synchronized(self){ self.state = AS_PLAYING; } } 

In method:

 - (void)handlePropertyChangeForQueue:(AudioQueueRef)inAQ propertyID:(AudioQueuePropertyID)inID 

immediately before this call:

 [self performSelector:@selector(handlePropertyChange:) onThread:internalThread withObject:[NSNumber numberWithInt:inID] waitUntilDone:NO modes:[NSArray arrayWithObject:NSDefaultRunLoopMode]]; 
-one
source

Source: https://habr.com/ru/post/1500485/


All Articles