Publish audio when already publishing video with Ant Media

475 views Asked by At

I try to reproduce a classroom in which a teacher will publish video and audio and student only video at first. Students can raise hand and teacher can accept to leave the student speak (all with dataChannel). I tried to change the mediaConstraints (enable audio) but as WebRTCAdaptor is basically stateless, it does not change a thing. Is there a simple way to publish audio as video is already published, as I cannot publish twice either.

1

There are 1 answers

0
EMK On

If you create a WebRTCAdaptor with a disabled audio, user would not be able to speak later. But you can use the Un/Mute mic funtions for that. As an example: webRTCAdaptor.muteLocalMic() would mute the microphone and webRTCAdaptor.unmuteLocalMic() These functions are included in the sample conference.html file. You can use these functions for your case.