0

そのため、AVPlayer を使用してオーディオ付きのビデオ ファイルをストリーミングしており、再生/一時停止、シークなどのコントロールを持つビデオに UIWebView をオーバーレイしています。実装しようとしているボリュームのスライダーもありますが、これまでのところ運がありません。音量を変更するコードは次のとおりです。

- (void)setPlayerVolume:(float)volume
{
    NSArray *tracks = [self.player.currentItem.asset tracksWithMediaType:AVMediaTypeAudio];
    NSMutableArray *audio = [NSMutableArray array];

    for (AVAssetTrack *track in tracks) {
        AVMutableAudioMixInputParameters *input = [AVMutableAudioMixInputParameters audioMixInputParameters];
        [input setVolume:volume atTime:kCMTimeZero];
        [input setTrackID:track.trackID];
        [audio addObject:input];
    }

    AVMutableAudioMix *mix = [AVMutableAudioMix audioMix];
    [mix setInputParameters:audio];
    [self.player.currentItem setAudioMix:mix];
}

私は読んでいますが、 MPVolumeViewを使用する唯一の解決策のようです。他の解決策はありますか?

ご協力いただきありがとうございます。

4

0 に答える 0