Starting audio call only in SImpleWebRTC

2019-08-17 01:08发布

问题:

I am using This jQuery plugin for WebRtc

I want to start audio call only but i can't see any function for this. I am using following code with autoRequestMedia:false :-

 webrtc = new SimpleWebRTC({
            localVideoEl: 'local-videos-container',
            remoteVideosEl: 'videos-container',
            autoRequestMedia: false,
            url: 'https://192.168.1.11:2001/'
});

So when user click on audio call i just want to start audio call only not video i can see the method webrtc.startLocalVideo() which start audio and video both. so is there any function for audio only?

Thanks

回答1:

You can pass media: { audio: true, video: false } to the constructor of webrtc.

try this:-

 webrtc = new SimpleWebRTC({
        localVideoEl: 'local-videos-container',
        remoteVideosEl: 'videos-container',
        autoRequestMedia: false,
        url: 'https://192.168.1.11:2001/',
        media: { audio: true, video: false }
 );