Skip to content

Commit

Permalink
meshcast/whip/mediamtx fix for screen sharing
Browse files Browse the repository at this point in the history
  • Loading branch information
steveseguin committed Nov 2, 2024
1 parent 46fb393 commit e93c2eb
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 25 deletions.
49 changes: 25 additions & 24 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -492,12 +492,12 @@ <h2 id="add_camera">
</form>
</div>
</center>
<div id="audioMenu" class="form-group multiselect" alt="tip: Hold CTRL (command) to select Multiple" title="tip: Hold CTRL (command) to select Multiple" aria-hidden="true">
<div id="audioMenu" class="form-group multiselect" alt="tip: Hold CTRL (command) to select Multiple" title="tip: Hold CTRL (command) to select Multiple">
<span class='gear_microphone hidden'>
<input type="checkbox" id='micStereoMonoInput' alt="Mono microphone audio" onchange="toggleMonoStereoMic(this);">Mono
</span>
<a id="multiselect-trigger" class="form-control multiselect-trigger" >
<div class="title">
<a id="multiselect-trigger" class="form-control multiselect-trigger" data-state="1">
<div class="title">
<i class="las la-microphone-alt"></i><span data-translate="select-audio-source"> Audio Source(s) </span>
<i id='chevarrow1' class="chevron bottom" aria-hidden="true"></i>
<div class="meter" id="meter1"></div><div class="meter2" id="meter2"></div>
Expand Down Expand Up @@ -993,7 +993,7 @@ <h2><span data-translate="get-the-native-app">Native Mobile Apps</span></h2>
Loading ...
</div>
</div>
<div id="container-11" class="column columnfade pointer rounded card hidden" style="overflow: hidden;" onclick="window.location = 'https://github.vdo.ninja';">
<div id="container-19" class="column columnfade pointer rounded card hidden" style="overflow: hidden;" onclick="window.location = 'https://github.vdo.ninja';">
<h2><span data-translate="get-the-source-code">Source Code</span></h2>
<i style="margin-top:30px;font-size:600%;overflow:hidden;" class="largeDarkIcon las la-code-branch"></i>
</div>
Expand Down Expand Up @@ -1079,7 +1079,7 @@ <h4>
<span style="color:#daad09;">Welcome to VDO Ninja! We've rebranded! Nothing else is changing and we're staying 100% free.</span>
</h4>
<br />
🎃 Site last updated on October 15th. You can also still access the previous version, which <a href="https://vdo.ninja/v25/">is hosted here</a>. Development <a target="_blank" title="Open a page with recent VDO.Ninja development and feature updates" href="https://updates.vdo.ninja/">updates are here.</a>
🎃 Last major update on October 15th. You can also still access the previous version, which <a href="https://vdo.ninja/v25/">is hosted here</a>. Development <a target="_blank" title="Open a page with recent VDO.Ninja development and feature updates" href="https://updates.vdo.ninja/">updates are here.</a>
<br />
<br />
<h3>
Expand Down Expand Up @@ -2543,25 +2543,26 @@ <h3 data-translate="publish-settings">Publishing setup</h3>

<div id="remoteOBSControl" class="customModelPopup" style="display:none;">
<div class="promptModalInner">
<span class='modalClose' onclick="toggleOBSControls();">×</span>
<span></span>
<h3 data-translate="remote-control-obs-menu">Remote Controller for OBS Studio</h3><br />
<div id="obsControlHelp" class="hidden" style="margin: 10px 0;display:block" >
No remote controllable instances of OBS Studio were found
</div>
<div id="obsControlButtons" style="margin: 10px 0;display:block" >
</div>
<div id="obsSceneNames" style="margin: 10px 0;display:block" >
</div>
<div id="obsRemotePassword" class="hidden" style="margin: 10px 0;display:block;" >
<span style="font-size:117%"><i class="las la-key" style="margin: 10px;"></i>Remote OBS passcode:</span>
<input style="margin:0 10px;display:inline-block;padding: 8px 10px 6px 10px;" placeholder="Enter the remote OBS password here" />
</div>
<small style="margin: 20px 0 0 0;display:block;" >
See the <a href="https://docs.vdo.ninja/advanced-settings/upcoming-parameters/and-obs" style="cursor:pointer;" target="_blank">documentation</a> for help on using the remote OBS controller
</small>
<div id="debugRemoteOBSControl" class="hidden">
</div>
<span class='modalClose' style="right:33px;" onclick="toggleOBSControlsLock(this);">🔓</span><span class='modalClose' onclick="toggleOBSControls();">×</span>
<span id="remoteOBSControlContents">
<h3 data-translate="remote-control-obs-menu">Remote Controller for OBS Studio</h3><br />
<div id="obsControlHelp" class="hidden" style="margin: 10px 0;display:block" >
No remote controllable instances of OBS Studio were found
</div>
<div id="obsControlButtons" style="margin: 10px 0;display:block" >
</div>
<div id="obsSceneNames" style="margin: 10px 0;display:block" >
</div>
<div id="obsRemotePassword" class="hidden" style="margin: 10px 0;display:block;" >
<span style="font-size:117%"><i class="las la-key" style="margin: 10px;"></i>Remote OBS passcode:</span>
<input style="margin:0 10px;display:inline-block;padding: 8px 10px 6px 10px;" placeholder="Enter the remote OBS password here" />
</div>
<small style="margin: 20px 0 0 0;display:block;" >
See the <a href="https://docs.vdo.ninja/advanced-settings/upcoming-parameters/and-obs" style="cursor:pointer;" target="_blank">documentation</a> for help on using the remote OBS controller
</small>
<div id="debugRemoteOBSControl" class="hidden">
</div>
</span>
</div>
</div>

Expand Down
36 changes: 35 additions & 1 deletion lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -2988,6 +2988,20 @@ function toggleOBSControls() {
}
}

function toggleOBSControlsLock(ele, disable = null) {
const element = getById("remoteOBSControlContents");

// If disable is not specified, toggle based on current state
// Otherwise, use the provided value
const shouldDisable = disable !== null ? disable :
element.style.pointerEvents !== 'none';

element.style.pointerEvents = shouldDisable ? 'none' : 'auto';
element.style.opacity = shouldDisable ? '0.6' : '1';
ele.textContent = shouldDisable ? '🔒' : '🔓';

return shouldDisable; // returns the new state
}
function requestOBSAction(ele) {
if (session.disableOBS) {
return false;
Expand Down Expand Up @@ -30554,6 +30568,16 @@ async function publishScreen2(constraints, audioList = [], audio = true, overrid

session.seeding = true;
session.seedStream();

if (session.whipOutput){ // was handling these functions within session.seedStream(); doing it here now instead. 8-08-2024
whipOut();
}
if (session.meshcast){
await meshcast();
}
if (session.whepHost){
whepOut();
}

//pokeIframeAPI('started-screenshare'); // depreciated
pokeIframeAPI("screen-share-state", true, null, session.streamID); // (action, value = null, UUID = null, SID=null)
Expand Down Expand Up @@ -31229,7 +31253,7 @@ session.publishFile = function (ele, event) {
}
};

v.onloadeddata = () => {
v.onloadeddata = async () => {

session.mediafileShare = true;
getById("mainmenu").remove();
Expand Down Expand Up @@ -31306,6 +31330,16 @@ session.publishFile = function (ele, event) {
session.updateLocalStatsInterval = setInterval(function () {
updateLocalStats();
}, session.statsInterval);

if (session.whipOutput){ // was handling these functions within session.seedStream(); doing it here now instead. 8-08-2024
whipOut();
}
if (session.meshcast){
await meshcast();
}
if (session.whepHost){
whepOut();
}

session.seeding = true;

Expand Down
4 changes: 4 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5725,6 +5725,10 @@ async function main() {
getById("container-13").style.display = "none";
getById("container-14").style.display = "none";
getById("container-15").style.display = "none";
getById("container-16").style.display = "none";
getById("container-17").style.display = "none";
getById("container-18").style.display = "none";
getById("container-19").style.display = "none";
getById("mainmenu").style.alignSelf = "center";
getById("mainmenu").classList.add("mainmenuclass");
getById("header").style.alignSelf = "center";
Expand Down

0 comments on commit e93c2eb

Please sign in to comment.