Skip to content

Commit 1e56cde

Browse files
committed
Add &nomutepreview option and apply &volume to previews
When streaming video, it was already possible to monitor input audio by showing video controls for the local video preview and pressing the unmute button. This PR adds two features to enhance this functionality: - Add an option, `&nomutepreview`, to automatically unmute the preview. If passed in sender mode, the preview still starts muted on the device selection screen, but gets unmuted when you press "start". This is to avoid undesired results if the wrong audio device is preselected. The option can also be passed in director mode in order to monitor the director's own stream. In this case it takes effect as soon as the director enables their microphone/video, since there's no separate device selection screen. - Apply the `&volume` setting to local video previews (again, in both sender and director mode). By itself, this does not unmute the preview, but determines what volume you get if you press the unmute button. This can also be combined with `&nomutepreview`. Documentation is included, but I wasn't able to test the formatting (I don't know how to replicate the Markdown-to-HTML process used for the docs site). Features _not_ included: - Monitoring a subset of input audio devices - Sending monitor output to a non-default audio device Still, this is good enough for me. My use case involves setting an Elgato HDMI capture device as the video/audio input in order to stream gameplay (directly through vdo.ninja, no OBS). I need to monitor audio in order to hear the game.
1 parent 97f016d commit 1e56cde

File tree

3 files changed

+49
-4
lines changed

3 files changed

+49
-4
lines changed

lib.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29193,6 +29193,9 @@ async function grabVideo(quality = 0, eleName = "previewWebcam", selector = "sel
2919329193
}
2919429194

2919529195
session.videoElement.controls = session.showControls || false;
29196+
if (typeof session.volume == "number") {
29197+
session.videoElement.volume = session.volume;
29198+
}
2919629199

2919729200
log("selector: " + selector);
2919829201
var videoSelect = document.querySelector(selector); // document.querySelector("videoSource3").value == "ZZZ"
@@ -31147,7 +31150,11 @@ async function press2talk(clean = false) {
3114731150
}
3114831151

3114931152
// videosource
31150-
session.videoElement.muted = true;
31153+
if (typeof session.volume == "number") {
31154+
session.videoElement.volume = session.volume;
31155+
}
31156+
session.videoElement.muted = !session.noMutePreview;
31157+
3115131158
session.videoElement.autoplay = true;
3115231159
session.videoElement.controls = session.showControls || false;
3115331160
session.videoElement.setAttribute("playsinline", "");
@@ -31429,6 +31436,10 @@ session.publishStream = function (v) {
3142931436
container.style.display = "none";
3143031437
}
3143131438

31439+
if (session.noMutePreview) {
31440+
v.muted = false;
31441+
}
31442+
3143231443
if (((session.roomid === false || session.roomid === "") && session.quality === false) || session.forceMediaSettings) {
3143331444
try {
3143431445
if (session.quality_wb !== false && session.quality === false) {

main.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3135,6 +3135,10 @@ async function main() {
31353135
}
31363136
}
31373137

3138+
if (urlParams.has("nomutepreview")) {
3139+
session.noMutePreview = true;
3140+
}
3141+
31383142
if (urlParams.has("obsfix")) {
31393143
session.obsfix = urlParams.get("obsfix");
31403144
if (session.obsfix) {

rawdoc.md

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,7 @@ Please report bugs. It's a first release, using the alpha version of VDO.Ninja,
631631
* [\&outboundaudiobitrate](source-settings/and-outboundaudiobitrate.md)
632632
* [\&inputchannels](advanced-settings/audio-parameters/and-inputchannels.md)
633633
* [\&monomic](advanced-settings/audio-parameters/and-monomic.md)
634+
* [\&nomutepreview](advanced-settings/audio-parameters/and-nomutepreview.md)
634635
* [\&audiooutput](https://docs.vdo.ninja/advanced-settings/view-parameters/and-outputdevice)
635636
* [\&sink](https://docs.vdo.ninja/advanced-settings/view-parameters/and-sink)
636637
* [\&volume](advanced-settings/audio-parameters/and-volume.md)
@@ -1628,6 +1629,31 @@ There is [`&mono`](../view-parameters/mono.md) to set the audio output to mono o
16281629
[and-inputchannels.md](and-inputchannels.md)
16291630

16301631
[mono.md](../view-parameters/mono.md)
1632+
1633+
---
1634+
description: Unmutes the local self-preview by default
1635+
---
1636+
1637+
# &nomutepreview
1638+
1639+
Sender-Side Option! ([`&push`](../source-settings/push.md))
1640+
1641+
## Details
1642+
1643+
If `&nomutepreview` is passed, the video preview will be unmuted when you press the start button, playing the microphone input back to you (audio monitoring).
1644+
1645+
You can also activate this during a stream by [showing the control bar](../newly-added-parameters/and-videocontrols.md) and using the volume control there.
1646+
1647+
This can also be passed in director mode and will affect the director's own stream.
1648+
1649+
## Related
1650+
1651+
[and-preview.md](../../source-settings/and-preview.md)
1652+
1653+
[and-nopreview.md](../../source-settings/and-nopreview.md)
1654+
1655+
[and-volume.md](../../source-settings/and-volume.md)
1656+
16311657
---
16321658
description: Disables all audio playback from room directors
16331659
---
@@ -1941,7 +1967,7 @@ You can add them to both, source ([`&push`](../../source-settings/push.md)) and
19411967

19421968
You have to add them to the source side ([`&push`](../../source-settings/push.md)).
19431969

1944-
<table><thead><tr><th width="286.57142857142856">Parameter</th><th>Explanation</th></tr></thead><tbody><tr><td><a href="../../source-settings/audiodevice.md"><code>&#x26;audiodevice</code></a></td><td>Pre-configures the selected audio device</td></tr><tr><td><a href="../../source-settings/aec.md"><code>&#x26;echocancellation</code></a></td><td>Automatic echo-cancellation is ON or OFF</td></tr><tr><td><a href="and-audiogain.md"><code>&#x26;audiogain</code></a></td><td>Applies a gain multiplier (as a percentage) to the local microphone</td></tr><tr><td><a href="../../source-settings/autogain.md"><code>&#x26;autogain</code></a></td><td>Sets whether audio auto-normalization is ON or OFF</td></tr><tr><td><a href="../../source-settings/and-compressor.md"><code>&#x26;compressor</code></a></td><td>Applies a generic audio compressor to the local microphone</td></tr><tr><td><a href="../../source-settings/and-denoise.md"><code>&#x26;denoise</code></a></td><td>Turn audio noise reduction filter ON or OFF</td></tr><tr><td><a href="and-distort.md"><code>&#x26;distort</code></a></td><td>Will try to "distort" your microphone's output audio, making your voice a bit anonymous</td></tr><tr><td><a href="../../source-settings/and-equalizer.md"><code>&#x26;equalizer</code></a></td><td>Provides access to a generic audio equalizer that can be applied to the local microphone</td></tr><tr><td><a href="../../source-settings/and-limiter.md"><code>&#x26;limiter</code></a></td><td>Applies a generic audio limiter to the local microphone</td></tr><tr><td><a href="../../source-settings/lowcut.md"><code>&#x26;lowcut</code></a></td><td>Adds a low-cut filter</td></tr><tr><td><a href="../../source-settings/noisegate.md"><code>&#x26;noisegate</code></a></td><td>Lowers your mic volume to 10% of its current value based on volume-level activity</td></tr><tr><td><a href="and-noisegatesettings.md"><code>&#x26;noisegatesettings</code></a></td><td>Lets you tweak the &#x26;noisegate variables, making it more or less aggressive as needed</td></tr><tr><td><a href="and-audiocontenthint.md"><code>&#x26;audiocontenthint</code></a></td><td><code>=music</code> fixed bitrate; <code>=speech</code> bitrate is variable</td></tr><tr><td><a href="../../newly-added-parameters/and-audiolatency.md"><code>&#x26;audiolatency</code></a></td><td>Adds an audio-latency to the published audio stream</td></tr><tr><td><a href="../../source-settings/and-micdelay.md"><code>&#x26;micdelay</code></a></td><td>Delays the microphone by specified time in ms</td></tr><tr><td><a href="../../source-settings/and-mute.md"><code>&#x26;mute</code></a></td><td>Starts with the microphone muted by default</td></tr><tr><td><a href="and-automute.md"><code>&#x26;automute</code></a></td><td>Will mute the microphone of a guest when not loaded in an active OBS scene</td></tr><tr><td><a href="../../source-settings/and-outboundaudiobitrate.md"><code>&#x26;outboundaudiobitrate</code></a></td><td>Target audio bitrate and max bitrate for outgoing audio streams</td></tr><tr><td><a href="and-inputchannels.md"><code>&#x26;inputchannels</code></a></td><td>Audio capture device to select N-number of audio channels</td></tr><tr><td><a href="and-monomic.md"><code>&#x26;monomic</code></a></td><td>Sets a guest's audio input to mono (1-channel)</td></tr></tbody></table>
1970+
<table><thead><tr><th width="286.57142857142856">Parameter</th><th>Explanation</th></tr></thead><tbody><tr><td><a href="../../source-settings/audiodevice.md"><code>&#x26;audiodevice</code></a></td><td>Pre-configures the selected audio device</td></tr><tr><td><a href="../../source-settings/aec.md"><code>&#x26;echocancellation</code></a></td><td>Automatic echo-cancellation is ON or OFF</td></tr><tr><td><a href="and-audiogain.md"><code>&#x26;audiogain</code></a></td><td>Applies a gain multiplier (as a percentage) to the local microphone</td></tr><tr><td><a href="../../source-settings/autogain.md"><code>&#x26;autogain</code></a></td><td>Sets whether audio auto-normalization is ON or OFF</td></tr><tr><td><a href="../../source-settings/and-compressor.md"><code>&#x26;compressor</code></a></td><td>Applies a generic audio compressor to the local microphone</td></tr><tr><td><a href="../../source-settings/and-denoise.md"><code>&#x26;denoise</code></a></td><td>Turn audio noise reduction filter ON or OFF</td></tr><tr><td><a href="and-distort.md"><code>&#x26;distort</code></a></td><td>Will try to "distort" your microphone's output audio, making your voice a bit anonymous</td></tr><tr><td><a href="../../source-settings/and-equalizer.md"><code>&#x26;equalizer</code></a></td><td>Provides access to a generic audio equalizer that can be applied to the local microphone</td></tr><tr><td><a href="../../source-settings/and-limiter.md"><code>&#x26;limiter</code></a></td><td>Applies a generic audio limiter to the local microphone</td></tr><tr><td><a href="../../source-settings/lowcut.md"><code>&#x26;lowcut</code></a></td><td>Adds a low-cut filter</td></tr><tr><td><a href="../../source-settings/noisegate.md"><code>&#x26;noisegate</code></a></td><td>Lowers your mic volume to 10% of its current value based on volume-level activity</td></tr><tr><td><a href="and-noisegatesettings.md"><code>&#x26;noisegatesettings</code></a></td><td>Lets you tweak the &#x26;noisegate variables, making it more or less aggressive as needed</td></tr><tr><td><a href="and-audiocontenthint.md"><code>&#x26;audiocontenthint</code></a></td><td><code>=music</code> fixed bitrate; <code>=speech</code> bitrate is variable</td></tr><tr><td><a href="../../newly-added-parameters/and-audiolatency.md"><code>&#x26;audiolatency</code></a></td><td>Adds an audio-latency to the published audio stream</td></tr><tr><td><a href="../../source-settings/and-micdelay.md"><code>&#x26;micdelay</code></a></td><td>Delays the microphone by specified time in ms</td></tr><tr><td><a href="../../source-settings/and-mute.md"><code>&#x26;mute</code></a></td><td>Starts with the microphone muted by default</td></tr><tr><td><a href="and-automute.md"><code>&#x26;automute</code></a></td><td>Will mute the microphone of a guest when not loaded in an active OBS scene</td></tr><tr><td><a href="../../source-settings/and-outboundaudiobitrate.md"><code>&#x26;outboundaudiobitrate</code></a></td><td>Target audio bitrate and max bitrate for outgoing audio streams</td></tr><tr><td><a href="and-inputchannels.md"><code>&#x26;inputchannels</code></a></td><td>Audio capture device to select N-number of audio channels</td></tr><tr><td><a href="and-monomic.md"><code>&#x26;monomic</code></a></td><td>Sets a guest's audio input to mono (1-channel)</td></tr><tr><td><a href="and-nomutepreview.md"><code>&#x26;nomutepreview</code></a></td><td>Unmutes the local self-preview by default</td></tr></tbody></table>
19451971

19461972
## **Viewer side options**
19471973

@@ -7655,6 +7681,8 @@ If you want the VDO.Ninja self-preview to not be mini-sized in [broadcast](../vi
76557681
[and-nopreview.md](../../source-settings/and-nopreview.md)
76567682

76577683
[broadcast.md](../view-parameters/broadcast.md)
7684+
7685+
[and-nomutepreview.md](../audio-parameters/and-nomutepreview.md)
76587686
---
76597687
description: Used to position where the mini preview is located by default on screen
76607688
---
@@ -19939,8 +19967,6 @@ Example: `&minipreview=0`
1993919967

1994019968
## Details
1994119969

19942-
## Details
19943-
1994419970
Shows the mini self-preview at the top right corner. This is the default behavior when [`&broadcast`](../advanced-settings/view-parameters/broadcast.md) mode is on.
1994519971

1994619972
You can change the default position of the mini preview with [`&minipreviewoffset`](../advanced-settings/video-parameters/and-minipreview-1.md).
@@ -19956,6 +19982,8 @@ You can change the default position of the mini preview with [`&minipreviewoffse
1995619982
[and-nopreview.md](and-nopreview.md)
1995719983

1995819984
[broadcast.md](../advanced-settings/view-parameters/broadcast.md)
19985+
19986+
[and-nomutepreview.md](../advanced-settings/audio-parameters/and-nomutepreview.md)
1995919987
---
1996019988
description: Starts with the microphone muted by default
1996119989
---
@@ -20180,6 +20208,8 @@ Forces the guest to have a self-preview.
2018020208
[and-minipreview.md](and-minipreview.md)
2018120209

2018220210
[and-nopreview.md](and-nopreview.md)
20211+
20212+
[and-nomutepreview.md](../audio-parameters/and-nomutepreview.md)
2018320213
---
2018420214
description: Auto mutes guest's video
2018520215
---

0 commit comments

Comments
 (0)