AudioSteamer的状态有时不会更改为AS_PLAYING

时间:2013-09-04 09:54:34

标签: ios audiostreamer

我使用Matt Gallagher的AudioSteamer来实现在线音乐播放功能,我发现有时在线音乐正在播放,但是音频抑制器的状态不会改变为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]];
}

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

1 个答案:

答案 0 :(得分:-1)

我也有这个问题。我添加了这段代码:

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

进入方法:

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

在此电话会议之前:

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