fix issue where undefined crashes pip2

This commit is contained in:
steveseguin 2023-08-05 09:13:25 -04:00
parent 4dde5190e1
commit 4749fe3bbf
3 changed files with 23 additions and 4 deletions

View File

@ -2641,11 +2641,11 @@
// session.hidehome = true; // If used, 'hide home' will make the landing page inaccessible, along with hiding a few go-home elements. // session.hidehome = true; // If used, 'hide home' will make the landing page inaccessible, along with hiding a few go-home elements.
// session.record = false; // uncomment to block users from being able to record via vdo.ninja's built in recording function // session.record = false; // uncomment to block users from being able to record via vdo.ninja's built in recording function
</script> </script>
<script type="text/javascript" crossorigin="anonymous" id="lib-js" src="./lib.js?ver=879"></script> <script type="text/javascript" crossorigin="anonymous" id="lib-js" src="./lib.js?ver=880"></script>
<!-- <!--
// If you wish to change branding, blank offers a good clean start. // If you wish to change branding, blank offers a good clean start.
<script type="text/javascript" id="main-js" src="./main.js" data-translation="blank"></script> <script type="text/javascript" id="main-js" src="./main.js" data-translation="blank"></script>
--> -->
<script type="text/javascript" crossorigin="anonymous" id="main-js" src="./main.js?ver=694"></script> <script type="text/javascript" crossorigin="anonymous" id="main-js" src="./main.js?ver=695"></script>
</body> </body>
</html> </html>

21
lib.js
View File

@ -7266,6 +7266,16 @@ function applyEffects(track) { // video only please. do not touch audio. Run up
} else { } else {
session.canvasSource.onloadeddata = mainMeshMask; session.canvasSource.onloadeddata = mainMeshMask;
} }
} else if (session.effect == "13"){ // ha, no way to turn it off once it's started, except to change cameras? not sure.
try {
track.applyConstraints({backgroundBlur: true}).then(() => {
const settings = track.getSettings();
log(`Background blur is ${settings.backgroundBlur ? "ON" : "OFF"}`);
}).catch(errorlog);
} catch(e){
errorlog(e);
}
return track;
} else { } else {
if (session.canvasource){ if (session.canvasource){
session.canvasSource.srcObject.getVideoTracks().forEach(function(trk) { session.canvasSource.srcObject.getVideoTracks().forEach(function(trk) {
@ -22299,6 +22309,15 @@ async function grabVideo(quality = 0, eleName = 'previewWebcam', selector = "sel
session.mirrorExclude = true; session.mirrorExclude = true;
} }
} }
if ("backgroundBlur" in capabilities){ // Chrome original trial, until v117, and then???
query('#effectSelector option[value="13"]').classList.remove("hidden");
query('#effectSelector option[value="13"]').disabled = null;
query('#effectSelector3 option[value="13"]').classList.remove("hidden");
query('#effectSelector3 option[value="13"]').disabled = null;
} else {
query('#effectSelector option[value="13"]').disabled = true;
query('#effectSelector3 option[value="13"]').disabled = true;
}
} }
} catch(e){} } catch(e){}
@ -30197,7 +30216,7 @@ function fullscreenPageToggle(state=null){
session.pipWindow = false; session.pipWindow = false;
async function PictureInPicturePageToggle(state=null){ async function PictureInPicturePageToggle(state=null){
try { try {
if (!documentPictureInPicture){return;} if (typeof documentPictureInPicture === "undefined"){return;}
if (session.pipWindow){ if (session.pipWindow){
getById("testtone").parentNode.insertBefore(session.pipWindow.document.getElementById("gridlayout"), getById("testtone")); getById("testtone").parentNode.insertBefore(session.pipWindow.document.getElementById("gridlayout"), getById("testtone"));
session.pipWindow.close(); session.pipWindow.close();

View File

@ -841,7 +841,7 @@ async function main(){ // main asyncronous thread; mostly initializes the user s
} }
if (urlParams.has('pip2') || urlParams.has('pipall')){ // just an alternative; might be compoundable if (urlParams.has('pip2') || urlParams.has('pipall')){ // just an alternative; might be compoundable
if (documentPictureInPicture){ if (typeof documentPictureInPicture !== "undefined"){
getById("PictureInPicturePage").classList.remove("hidden"); getById("PictureInPicturePage").classList.remove("hidden");
} }
} }