ios APP如何支持VP8编码

IOS默认支持H264的硬件编解码,iOS12.2 和 macOS 10.14.4平台的最新版Safar 12.1也新增了对VP8视频编解码的支持,支持通其它webrtc终端视频通话。
那么为了能让IOS app与其它webrtc终端视频通话,怎样才能实现IOS app对VP8编码的支持呢?

  • (RTCPeerConnectionFactory *)connectionFactory{
    if (!_connectionFactory){
    //先初始化工厂
    RTCVideoCodecInfo *codecInfo = [[RTCVideoCodecInfo alloc]initWithName:@“VP8”];
    RTCDefaultVideoEncoderFactory *videoEncoderFactoryr = [[RTCDefaultVideoEncoderFactory alloc]init];
    id videoDecoderFactory = [[RTCDefaultVideoDecoderFactory alloc]init];
    // for ( RTCVideoCodecInfo *obj in videoDecoderFactory.supportedCodecs) {
    // NSLog(@“Decoderobj = %@”,obj.name);
    // }
    // for ( RTCVideoCodecInfo *obj in videoEncoderFactoryr.supportedCodecs) {
    // NSLog(@“Encoderobj = %@”,obj.name);
    // }
    videoEncoderFactoryr.preferredCodec = codecInfo;
    _connectionFactory = [[RTCPeerConnectionFactory alloc] initWithEncoderFactory:videoEncoderFactoryr decoderFactory:videoDecoderFactory];
    }
    return _connectionFactory;
    }