android
android copied to clipboard
How to turn on the simulcast?
Hi, I used your SDK in my code and everything is fine with the push stream. But when I added the simulcast related configuration to the code, there was only one stream when played. Here's my code. Is my configuration incorrect? ` val encodings= mutableListOf<RtpParameters.Encoding>() encodings.add(RtpParameters.Encoding("h", true, 1.0)) encodings.add(RtpParameters.Encoding("m", true, 2.0)) encodings.add(RtpParameters.Encoding("l", true, 4.0))
val init = RtpTransceiver.RtpTransceiverInit(
RtpTransceiver.RtpTransceiverDirection.SEND_RECV, Collections.emptyList(), encodings
)
peerConnection!!.addTransceiver(MediaStreamTrack.MediaType.MEDIA_TYPE_VIDEO, init)`
`val decoderFactory: VideoDecoderFactory = DefaultVideoDecoderFactory(eglBase!!.eglBaseContext) val encoderFactory: VideoEncoderFactory = DefaultVideoEncoderFactory( eglBase!!.eglBaseContext, true, true )
val simulcastVideo = SimulcastVideoEncoderFactory(encoderFactory,encoderFactory)
PeerConnectionFactory.initialize(
PeerConnectionFactory.InitializationOptions
.builder(context)
.createInitializationOptions()
)
PeerConnectionFactory.builder()
.setOptions(PeerConnectionFactory.Options())
.setAudioDeviceModule(JavaAudioDeviceModule.builder(context).createAudioDeviceModule())
.setVideoEncoderFactory(simulcastVideo)
.setVideoDecoderFactory(decoderFactory)
.createPeerConnectionFactory()`