4

我使用Matt Gallagher的AudioSteamer实现在线音乐播放功能,我发现有时候在线音乐正在播放但audiostreamer的状态没有变为AS_PLAYING,有人遇到同样的问题吗?能告诉我怎么解决这个问题吗~~谢谢~

我想原因之一是:

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

在这些代码执行之后

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

功能:

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

不执行...我真的不知道如何解决它...有人帮助我吗?谢谢..

4

1 回答 1

-1

I also have this problem. I added this code:

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

Into the method:

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

just before this call:

[self
    performSelector:@selector(handlePropertyChange:)
    onThread:internalThread
    withObject:[NSNumber numberWithInt:inID]
    waitUntilDone:NO
    modes:[NSArray arrayWithObject:NSDefaultRunLoopMode]];
于 2013-10-22T14:58:51.367 回答