This array allows you either manage all your local streams; or attach external (your-own-captured) media streams
connection.attachStreams.forEach(function(localStream) { localStream.stop(); });
connection.attachStreams = [yourExternalStream]; // or connection.attachStreams.push(yourExternalStream);
parameter | description |
---|---|
attachStreams | It is a JavaScript array |
MediaStream | webkitMediaStream or native "MediaStream" object |
connection.dontCaptureUserMedia = true; connection.attachStreams = [yourExternalStream]; connection.addStream({ audio: true, video: true, oneway: true });
<script src="https://rtcmulticonnection.herokuapp.com/dist/RTCMultiConnection.min.js"></script> <script src="https://rtcmulticonnection.herokuapp.com/socket.io/socket.io.js"></script> <script> var connection = new RTCMultiConnection(); // this line is VERY_important connection.socketURL = 'https://rtcmulticonnection.herokuapp.com:443/'; // if you want audio+video conferencing connection.session = { audio: true, video: true }; connection.dontCaptureUserMedia = true; navigator.webkitGetUserMedia({ video: true, audio: true }, function(yourExternalStream) { connection.attachStreams = [yourExternalStream]; connection.openOrJoin('your-room-id'); }, function(error) {}); </script>