SIP.js
SIP.js copied to clipboard
Force VP8 codec usage.
Is your feature request related to a problem? Please describe.
Safari is the problem child of WebRTC implementation. They recently introduced a bug that straight up breaks our implementation if we use the H.264 codec. https://bugs.webkit.org/show_bug.cgi?id=232006 . I have no faith in Apple fixing this in a timely manner. I also have no faith in a further regression. The solution is to force the usage of VP8 by safari.
Describe the solution you'd like
I would like a field in the userAgentOptions
where you can select what the video codec is set to.
Describe alternatives you've considered
So there's this post: https://stackoverflow.com/questions/51788193/webrtc-and-peerjs-how-to-choose-h264-instead-of-vp8 . The method they describe is only available in safari so you'd basically be forced to manually alter the SDP. I feel that is asking for trouble.
Additional context
I don't think this is possible with the current implementation, but there's a lot about the sessionDescriptionHandlerFactory
I don't understand.
So there's this post: https://stackoverflow.com/questions/51788193/webrtc-and-peerjs-how-to-choose-h264-instead-of-vp8 . The method they describe is only available in safari so you'd basically be forced to manually alter the SDP. I feel that is asking for trouble.
Currently, there's no method to enforce a codec... As noted on the topic, setCodecProferences is only available on Safari atm.
So yeah, there's no easy way, you need to mangle the SDP offer manually. You can do that using a SessionDescriptionHandlerModifier:
import { SessionDescriptionHandlerModifier, Inviter } from 'sip.js'
const modifier: SessionDescriptionHandlerModifier = (description) => {
let { sdp = '' } = description
// modify the sdp
description.sdp = sdp
return Promise.resolve(description)
}
// use your modifier on your INVITE
const inviter = new Inviter(userAgent, target, {
sessionDescriptionHandlerModifiers: [modifier]
})
Perhaps you can use the modifiers exposed on the library as a reference...
Thanks. If Safari doesn't fix this that gives me a start on how to change the SDP manually.
Is this still an issue with current Safari?