Is it possible to broadcast audio using shielding using WebRTC

Can I cast audio using shielding using WebRTC? A simple call to getUserMedia with audio: true fails. Is there any work that can be used to broadcast sound? Will sound be implemented next to shielding?

Thanks.

+6
source share
3 answers

See this demo: Share your screen and audio / video from a peer to peer connection!

Several threads are committed and tied to a peer single . AFAIK, sound with chromeMediaSource:screen is equal to " not yet allowed ."


Updated April 21, 2016

Now you can capture audio + screen using a single getUserMedia request in both Firefox and Chrome.

However, Chrome just supports the audio + tab , i.e. You cannot record full screen with sound.

Audio + tab means any chrome tab with a microphone.


Updated January 9, 2017

You can capture both audio and screen streams by running two parallel (UNIQUE) getUserMedia requests.

Now you can use the addTrack method to add audio tracks to the screen stream:

 var audioStream = captureUsingGetUserMedia(); var screenStream = captureUsingGetUserMedia(); var audioTrack = audioStream.getAudioTracks()[0]; // add audio tracks into screen stream screenStream.addTrack( audioTrack ); 

screenStream now has both audio and video tracks.

 nativeRTCPeerConnection.addStream( screenStream ); nativeRTCPeerConnection.createOffer(success, failure, options); 
+6
source

In Firefox, you can use getUserMedia to capture the / etc screen and microphone sound in the same request and you can attach it to PeerConnection. You can combine it with other streams - for several audio or video tracks in one PeerConnection in Firefox, Firefox 38 or later is required. 38 is currently a version for developers (formerly called Aurora). 38 should come out within about 9 weeks or so.

+2
source

Yes, you can record sound and screen recording on chrome with two queries.

  getScreenId(function (error, sourceId, screen_constraints) { 

capture screen

  navigator.getUserMedia = navigator.mozGetUserMedia || navigator.webkitGetUserMedia; navigator.getUserMedia(screen_constraints, function (stream) { navigator.getUserMedia({audio: true}, function (audioStream) { stream.addTrack(audioStream.getAudioTracks()[0]); var mediaRecorder = new MediaStreamRecorder(stream); mediaRecorder.mimeType = 'video/mp4' mediaRecorder.stream = stream; document.querySelector('video').src = URL.createObjectURL(stream); var video = document.getElementById('screen-video') if (video) { video.src = URL.createObjectURL(stream); video.width = 360; video.height = 300; } }, function (error) { alert(error); }); }, function (error) { alert(error); }); }); 
+2
source

Source: https://habr.com/ru/post/955986/


All Articles