2

カスタムオーディオプレーヤーに取り組んでいます。UISlider を使用して音量を調整しています。iPad で再生すると問題なく動作します。しかし、AirPlay を使用すると音量が調整されません。

音量を調整するコードは次のとおりです。

UISlider* slide = sender;

   NSArray *audioTracks = [myPlayer.currentItem.asset tracksWithMediaType:AVMediaTypeAudio];
    NSMutableArray *allAudioParams = [NSMutableArray array];
    for (AVAssetTrack *track in audioTracks) {
        AVMutableAudioMixInputParameters *audioInputParams =[AVMutableAudioMixInputParameters audioMixInputParametersWithTrack:track];
        [audioInputParams setVolume:slide.value atTime:myPlayer.currentTime];
        [audioInputParams setTrackID:[track trackID]];
        [allAudioParams addObject:audioInputParams];
    }
    AVMutableAudioMix *audioZeroMix = [AVMutableAudioMix audioMix];
    [audioZeroMix setInputParameters:allAudioParams];
    [myPlayer.currentItem setAudioMix:audioZeroMix];
4

0 に答える 0