-1

I came up with the idea of ​being able to record the lectures I make with other pairs so I can download them later, according to my theory, the simplest way would be to record the screen sequence and add the remote audio tracks. Try using getTracksAudio and then addTracks in the mediaStream object of my screen, but I get an error that says that the last parameter is not an audio track itself.

Example of my code:

$rootScope.$on('videoAdded', function(event, data) {
    // I hear the event when a video is added..
    if(data.stream !== 'screenStream') {
        var audioTracks = data.stream.getAudioTracks();
    }
    else {
        var captureStream = data.stream;
        captureStream.addTrack(audioTracks); 
    };
});

Code like this would return an error saying that the first parameter is not an audio track specifically.

I would like to be able to correctly capture the remote audio tracks, include them in the stream received by someone who shares their screen and then download it (if it is really possible).

Dmitry Shvedov
  • 3,169
  • 4
  • 39
  • 51
  • 1
    Weird code. `captureStream` is a `'screenStream'` string, and `audioTracks` is `undefined` in the *else* block... – jib Mar 12 '19 at 00:40

1 Answers1

0

getAudioTracks() returns an array of tracks. addTrack only takes a single track.

captureStream.addTrack(audioTracks[0]) should work better.

Philipp Hancke
  • 15,855
  • 2
  • 23
  • 31
  • how much is a MediaStream object from a remote camera, I can record and download it without problems, but if it is a stream of a shared screen, the video that I download is literally a photo. Is this normal? – lucas emanuel himelfarb Mar 12 '19 at 20:21