There are many possible cases:
- Setup audio-only connection
- Setup audio/video connection however disable video-tracks
- Setup audio/video connection however change video-mLine's attribute "sendrecv" to "inactive"
- Setup audio/video connection; keep sending video however on target user's side, either remove "src" or hide video-element or use invisible video element.
It seems that first options suits your needs.
Setting-up audio-only connection is as easy as:
- Invoking
getUserMedia
with{audio:true}
and addingMediaStream
to peer connection. - While invoking
createOffer/createAnswer
methods; settingOfferToReceiveAudio:true
howeverOfferToReceiveVideo:false
- Remember, both are true by default.
P.S. Audio-only connection still works if you set OfferToReceiveVideo:true
.
To share users' snapshot; obviously you can either use XMLHttpRequest/DB or WebSocket/etc. to exchange Data-URLs
among users.
It is possible to set poster
of video-element; however make sure that you've not set src
at the same time; otherwise poster
will fail.