Skip to content

Commit

Permalink
version 25.0
Browse files Browse the repository at this point in the history
  • Loading branch information
steveseguin committed Mar 29, 2024
1 parent 4a5f769 commit d82ab92
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 27 deletions.
16 changes: 8 additions & 8 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@

<script type="text/javascript" crossorigin="anonymous" src="./thirdparty/CodecsHandler.js?ver=10"></script>
<script type="text/javascript" crossorigin="anonymous" src="./thirdparty/aes.js"></script>
<script type="text/javascript" crossorigin="anonymous" src="./webrtc.js?ver=780"></script>
<script type="text/javascript" crossorigin="anonymous" src="./webrtc.js?ver=781"></script>
<input id="zoomSlider" type="range" style="display: none;" />
<span id="electronDragZone" style="pointer-events: none; z-index:-10; position:absolute;top:0;left:0;width:100%;height:2%;-webkit-app-region: drag;min-height:20px;"></span>
<div id="header">
Expand Down Expand Up @@ -1007,18 +1007,18 @@ <h2>What is VDO.Ninja</h2>
</i>
<br />
<li>
If the video fails to load in OBS Studio, where the browser source remains blank, try disabling hardware-acceleration or
<a href='https://docs.vdo.ninja/common-errors-and-known-issues/obs.ninja-doesnt-show-up-in-obs-or-is-choppy' title="Click to link out to the VDO.Ninja help guide for common OBS Studio problems" target="_blank">refer to this help guide</a> for more.
Starting OBS in Administrator mode has resolved a couple recent user issues related to Windows Firewall P2P blocking and video/audio degraded performance issues.
</li>
<li>
Samsung smartphones (A-series) may fail to publish video with some mobile browsers; try using Firefox Mobile or the native <a href='https://docs.vdo.ninja/getting-started/native-mobile-app-versions#android-download-link' title="Info on the native app versions of VDO.Ninja">Android app</a> in these cases.
If the video fails to load in OBS Studio, where the browser source remains blank, try disabling hardware-acceleration or
<a href='https://docs.vdo.ninja/common-errors-and-known-issues/obs.ninja-doesnt-show-up-in-obs-or-is-choppy' title="Click to link out to the VDO.Ninja help guide for common OBS Studio problems" target="_blank">refer to this help guide</a> for more.
</li>
<br />
<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 December 19th. You can also still access the previous version, which <a href="https://vdo.ninja/v23/">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>
🌱 Site last updated on March 29th. You can also still access the previous version, which <a href="https://vdo.ninja/v24/">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 @@ -2584,7 +2584,7 @@ <h3>Assign to slot:</h3><br />
// if (!window.location.search){document.body.innerHTML = "";} // uncomment this line, if you wish to try it.

var session = WebRTC.Media; // session is a required global variable if configuring manually. Run before loading main.js but after webrtc.js.
session.version = "24.9";
session.version = "25.0";
session.streamID = session.generateStreamID(); // randomly generates a streamID for this session. You can set your own programmatically if needed

session.defaultPassword = "someEncryptionKey123"; // Change this password if self-deploying for added security/privacy
Expand Down Expand Up @@ -2705,7 +2705,7 @@ <h3>Assign to slot:</h3><br />
// session.decrypted = session.decodeInvite("U2FsdGVkX1+d58DFIHoO3EQZSuX86ch4PqW2ouztnJ0="); // get a code from invite.cam

</script>
<script type="text/javascript" crossorigin="anonymous" id="lib-js" src="./lib.js?ver=1137"></script>
<script type="text/javascript" crossorigin="anonymous" id="main-js" src="./main.js?ver=844"></script>
<script type="text/javascript" crossorigin="anonymous" id="lib-js" src="./lib.js?ver=1140"></script>
<script type="text/javascript" crossorigin="anonymous" id="main-js" src="./main.js?ver=848"></script>
</body>
</html>
66 changes: 62 additions & 4 deletions lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -18776,7 +18776,6 @@ async function createDirectorOnlyBox() {
if (session.slotmode){
pokeIframeAPI("slot-updated", biggestSlot, null, session.streamID); // need to support self-director
session.pastSlots[session.streamID] = biggestSlot;

createSlotUpdate();
}
}
Expand Down Expand Up @@ -18988,7 +18987,6 @@ async function createDirectorScreenshareOnlyBox() { // sstype=3
if (session.slotmode){
pokeIframeAPI("slot-updated", biggestSlot, null, session.streamID+":s"); // need to support self-director
session.pastSlots[session.streamID+":s"] = biggestSlot;

createSlotUpdate();
}
}
Expand Down Expand Up @@ -19807,7 +19805,7 @@ async function enumerateDevices() {
errorlog(e);
if (!session.cleanOutput){
if (location.protocol !== 'https:') {
warnUser("Error listing the media devices.\n\nThe website needs to be loaded via https (ssl) to access media devices.");
warnUser("Error listing the media devices.\n\nThe website needs to be loaded via https (ssl) to access media devices.\n\nPossible solutions include switching to HTTPS, accessing the site from localhost, using the `unsafely-treat-insecure-origin-as-secure` browser switch, or using the Electron Capture desktop app instead.");
} else if (("isSecureContext" in window) && (window.isSecureContext===false)){
warnUser("Error listing the media devices.\n\nThe website may have assets loaded in an insecure context.");
} else {
Expand Down Expand Up @@ -22067,6 +22065,54 @@ function playtone(screen = false, tonename="testtone") {
}
}

function updateAudioSource(newUrl) {
var audioElement = document.getElementById('testtone');
var sources = audioElement.getElementsByTagName('source');
var extension = newUrl.split('.').pop().toLowerCase();
var mimeType;

switch (extension) {
case 'mp3':
mimeType = 'audio/mpeg';
break;
case 'wav':
mimeType = 'audio/wav';
break;
case 'ogg':
mimeType = 'audio/ogg';
break;
case 'aac':
case 'm4a':
mimeType = 'audio/aac';
break;
case 'opus':
mimeType = 'audio/opus';
break;
case 'flac':
mimeType = 'audio/flac';
break;
case 'webm':
mimeType = 'audio/webm';
break;
default:
console.error('Unsupported file type:', extension);
return;
}
if (sources.length === 1) {
sources[0].src = newUrl;
sources[0].type = mimeType;
} else {
audioElement.innerHTML = '';
var newSource = document.createElement('source');
newSource.src = newUrl;
newSource.type = mimeType;
audioElement.appendChild(newSource);
}
audioElement.load();
}



function showNotification(title, body="") {
if (!Notification){return;}
if (Notification.permission !== 'granted') {
Expand Down Expand Up @@ -40402,7 +40448,19 @@ function whipOut(){

xhttp.onerror = function(e) {
errorlog(e);
warnUser("Whip out failed.");

if ((window.location.protocol=="https:") && session.whipOutput.startsWith("http://") && !session.whipOutput.startsWith("http://localhost")){
console.warn("Mixed HTTP and HTTPS content; this may not work. There are some options, like using localhost, disabling web security in your browser, or using SSL entirely");
if (!session.cleanOutput){
if (window.location.hostname === "vdo.ninja"){
warnUser("Error: You cannot publish to an HTTP WHIP endpoint from an HTTPS-enabled website.\n\nThere are some possible exceptions and solutions, such as deploying an SSL certificate, hosting from localhost, trying from http://insecure.vdo.ninja, and/or using the Electron Capture app.");
} else {
warnUser("Error: You cannot publish to an HTTP WHIP endpoint from an HTTPS-enabled website.");
}
}
} else if (!session.cleanOutput){
warnUser("WHIP out failed.\n\nCheck the developer console for possible details.");
}
};
xhttp.send(data);

Expand Down
28 changes: 23 additions & 5 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,6 @@ async function main(){ // main asyncronous thread; mostly initializes the user s
}
}


if (urlParams.has('broadcasttransfer') || urlParams.has('bct')) {
log("Broadcast transfer flag set");
session.broadcastTransfer = urlParams.get('broadcasttransfer') || urlParams.get('bct') || null;
Expand Down Expand Up @@ -1193,7 +1192,11 @@ async function main(){ // main asyncronous thread; mostly initializes the user s
session.videoMutedFlag = true;
}

if (urlParams.has('layout')) {
if (urlParams.get('viewslot')){
session.viewslot = parseInt(urlParams.get('viewslot')) || false;
session.accept_layouts = true;
session.layout = {};
} else if (urlParams.has('layout')) {

if (!urlParams.get('layout')){
session.accept_layouts = true;
Expand Down Expand Up @@ -1622,8 +1625,10 @@ async function main(){ // main asyncronous thread; mostly initializes the user s
//}

if (urlParams.has('hiddenscenebitrate')) {
session.hiddenSceneViewBitrate = parseInt(urlParams.get('hiddenscenebitrate')) || 0;
} else if (urlParams.has('layout') && (session.scene!==false)){
session.hiddenSceneViewBitrate = parseInt(urlParams.get('hiddenscenebitrate')) || 0;
} else if (urlParams.has('layout') && (session.scene!==false) && !session.viewslot){
session.hiddenSceneViewBitrate = false;
} else if (urlParams.has('nohiddensceneoptimization')) {
session.hiddenSceneViewBitrate = false;
}

Expand Down Expand Up @@ -3393,7 +3398,6 @@ async function main(){ // main asyncronous thread; mostly initializes the user s
} else if (Notification.permission !== 'granted') {
Notification.requestPermission();
}

}
if (urlParams.has('r2d2')) {
/* var addtone = createAudioElement();
Expand All @@ -3409,6 +3413,20 @@ async function main(){ // main asyncronous thread; mostly initializes the user s
session.beepToNotify = true;
}

if (urlParams.get("custombeep")){
updateAudioSource(urlParams.get("custombeep"));
}

if (urlParams.has("beepvolume")){
try { // jointone
document.getElementById('testtone').volume = parseInt(urlParams.get("beepvolume"))/100 || 0;
document.getElementById('jointone').volume = parseInt(urlParams.get("beepvolume"))/100 || 0;
document.getElementById('leavetone').volume = parseInt(urlParams.get("beepvolume"))/100 || 0;
} catch(e){
console.error(e);
}
}

if (urlParams.has('easyexit') || urlParams.has('ee')) {
session.noExitPrompt = true;
}
Expand Down
2 changes: 1 addition & 1 deletion webrtc.js

Large diffs are not rendered by default.

23 changes: 14 additions & 9 deletions whip.html
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,21 @@
background-color: #182031;
}

.inputCombo {
.inputComboGrid,.inputCombo {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
flex-grow: 1;
}
@media only screen and (max-width: 699px) {
.inputComboGrid {
display: grid;
padding: 0px 5px;
}
.inputComboGrid > * {
margin: 2px 0;
}
}
#version{
margin: 0 auto;
font-size: 30%;
Expand Down Expand Up @@ -318,7 +327,7 @@ <h3>Publish a video from VDO.Ninja to a WHIP ingestion end-point</h3>
<div class="details">⚙️</div>
</div>

<div class="inputCombo" id="advanced" style="margin: 10px 0px 10px 10px;">
<div class="inputComboGrid" id="advanced" style="margin: 10px 0px 10px 10px;">
<select style="border-radius:10px;margin-right:5px;width:unset!important;" class="changeText" id="whipoutaudiobitrate" title="Which audio bitrate target would you prefer? 128-kbps is fine for music." >
<option value="0" selected>🎙️Default Audio Bitrate</option>
<option value="32">🎙️32-kbps</option>
Expand All @@ -343,7 +352,7 @@ <h3>Publish a video from VDO.Ninja to a WHIP ingestion end-point</h3>
<option value="0">🎙️Mono</option>
</select >
</div>
<div class="inputCombo" id="advanced2" style="margin: 10px 0px 10px 10px;">
<div class="inputComboGrid" id="advanced2" style="margin: 10px 0px 10px 10px;">
<select style="border-radius:10px;margin-right:5px;width:unset!important;" class="changeText" id="bitrateGroupFlag" title="Which video bitrate target would you prefer?" >
<option value="0" selected>🎦Default Video Bitrate</option>
<option value="500">🎦500-kbps</option>
Expand Down Expand Up @@ -417,7 +426,7 @@ <h3>Play a remote video stream available via WHEP</h3>
<input type="password" id="changeText3a" class="inputfield changeText" placeholder="🗝️ Authentication Bearer Token (optional)" />
<div class="details">⚙️</div>
</div>
<div class="inputCombo" id="advancedwhep" style="margin: 10px 0px 10px 10px;">
<div class="inputComboGrid" id="advancedwhep" style="margin: 10px 0px 10px 10px;">
<select style="border-radius:10px;margin-right:5px;width:unset!important;" class="changeText" id="whepbuffer" title="Adding a playback buffer can help reduce frame loss or jitter" >
<option value="0" selected>⌛No added playback buffer</option>
<option value="500">⌛500-ms added</option>
Expand All @@ -437,7 +446,7 @@ <h3>Play a remote video stream available via WHEP</h3>
<option value="1">🔑 E2EE On</option>
</select >
</div>
<div class="inputCombo" id="advanced3" style="margin: 10px 0px 10px 10px;">
<div class="inputComboGrid" id="advanced3" style="margin: 10px 0px 10px 10px;">
<select style="border-radius:10px;margin-right:5px;width:unset!important;" class="changeText" id="stereowhep" title="Stereo is available only if auto-gain and noise-reduction is off." >
<option value="1" selected>🎙️Stereo</option>
<option value="0">🎙️Mono</option>
Expand Down Expand Up @@ -571,10 +580,6 @@ <h3 style='cursor:pointer;'>For community support</h3>

function gohere1(){
if (document.getElementById('changeText1').value){

if (document.getElementById('changeText1').value.startsWith("http://")){
document.getElementById('changeText1').value = document.getElementById('changeText1').value.replace("http://","https://");
}

localStorage.setItem('changeText1', document.getElementById('changeText1').value);
localStorage.setItem('changeText1a', document.getElementById('changeText1a').value || "");
Expand Down

0 comments on commit d82ab92

Please sign in to comment.