0

AVQueuePlayer を使用して 2 つのサウンドを順番に再生しようとしていますが、どちらも再生されません。AVAudioPlayer を使用して個別に再生できます。

これが私のキュープレーヤーコードです:

NSURL *hitURL = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/sfx_hit.wav", [[NSBundle mainBundle]resourcePath]]];
    NSURL *dieURL = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/sfx_die.wav", [[NSBundle mainBundle]resourcePath]]];

    AVPlayerItem *hit = [AVPlayerItem playerItemWithURL:hitURL];
    AVPlayerItem *die = [AVPlayerItem playerItemWithURL:dieURL];

    NSArray *playerItems = [NSArray arrayWithObjects:hit, die, nil];

    AVQueuePlayer *queuePlayer = [AVQueuePlayer queuePlayerWithItems:playerItems];
    [queuePlayer play];
4

1 に答える 1