How to enable VP8 on iOS WebRTC?

Viewed 801

How to enable VP8 on iOS WebRTC? I have build webrtc on ios and I can see libvpx in webrtc source code for ios. However I do not know how to enable it.

PeerConnection to createOffer only has h264 and there was no VP8 description in SDP.

Thank you for helping

1 Answers

You have to set preferedCodec for RTCDefaultVideoEncoderFactory:

let encoderFactory = RTCDefaultVideoEncoderFactory()

// Set video codec to VP8
encoderFactory.preferredCodec = RTCVideoCodecInfo(name: kRTCVideoCodecVp8Name)

let factory = RTCPeerConnectionFactory(
    encoderFactory: encoderFactory,
    decoderFactory: RTCDefaultVideoDecoderFactory()
)
Related