ScarletsFiction / SFMediaStream

HTML5 media streamer library for playing music, video, playlist, or even live streaming microphone & camera with node server
MIT License
102 stars 30 forks source link

How can I disable get mic #20

Closed Tuner32 closed 3 years ago

Tuner32 commented 3 years ago

https://github.com/ScarletsFiction/SFMediaStream/blob/v1/src/MediaPresenter.js line 171 How can I edit to request notting. I need to only send a audio node. I just have a problem on host computer. There are no mic, and I can't install virtual mic.

Tuner32 commented 3 years ago

Solved

StefansArya commented 3 years ago

Ehh really!? That's nice!

I haven't finished improving the library, and sadly the MediaRecorder must have a MediaStream as the parameter. So I should do some workaround to make it possible to not recording the mic/camera/screen.

Tuner32 commented 3 years ago

Yes, you are right, I have to make mediastream , So I just used captureStream to change mediastream and loop with autoplay and I put on mediaGranted. I think it is not way to disable mic, But it work well.

StefansArya commented 3 years ago

The AudioStreamer on v1.3.0 now expose the audio element. I haven't test it for your case, but you can now use the audio element directly from AudioStreamer's instance and pass it into the Presenter to be recorded.

The code below can also be a workaround too. Maybe some line can be removed from my code.

var instance = new ScarletsAudioStreamer(...);
var streamerElement = instance.element;
var audioContext = ScarletsMedia.audioContext;

// Maybe this is not necessary
// Mute from current device, but don't mute for the recorder
var gainNode = audioContext.createGain();
gainNode.gain.value = 0;
instance.connect(gainNode);
gainNode.connect(audioContext.destination);

var presenter = new ScarletsMediaPresenter({
    element: streamerElement
});
...
Tuner32 commented 3 years ago

That is cool. I think it is really useful to receive and stream again