mirror of
https://github.com/eliasstepanik/vdo.ninja.git
synced 2026-01-15 07:38:32 +00:00
rear camera on mobile mirror fix;
impacts non-english mobile phones
This commit is contained in:
parent
7083e66e0e
commit
4e91222861
19
lib.js
19
lib.js
@ -12033,6 +12033,7 @@ async function grabVideo(quality = 0, eleName = 'previewWebcam', selector = "sel
|
||||
}
|
||||
}
|
||||
var obscam = false;
|
||||
var mirrorcheck = false;
|
||||
log(videoSelect.options[videoSelect.selectedIndex].text);
|
||||
if (videoSelect.options[videoSelect.selectedIndex].text.startsWith("OBS-Camera")) { // OBS Virtualcam
|
||||
mirror = true;
|
||||
@ -12064,6 +12065,9 @@ async function grabVideo(quality = 0, eleName = 'previewWebcam', selector = "sel
|
||||
getById("cameraTipContext1").innerHTML = "<i>Tip:</i> A Cam Link may glitch green/purple if accessed elsewhere while already in use.";
|
||||
getById("cameraTip1").classList.remove("advanced");
|
||||
}
|
||||
} else if (session.mobile){
|
||||
mirrorcheck = true;
|
||||
mirror = false;
|
||||
} else {
|
||||
mirror = false;
|
||||
}
|
||||
@ -12088,6 +12092,21 @@ async function grabVideo(quality = 0, eleName = 'previewWebcam', selector = "sel
|
||||
checkBasicStreamsExist();
|
||||
|
||||
stream.getVideoTracks().forEach(function(track) {
|
||||
|
||||
try{
|
||||
if (mirrorcheck){
|
||||
const capabilities = track.getCapabilities();
|
||||
if ("facingMode" in capabilities){
|
||||
if (capabilities.facingMode == "environment"){
|
||||
mirror=true;
|
||||
session.mirrorExclude = mirror;
|
||||
//applyMirror(mirror, eleName);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch(e){
|
||||
}
|
||||
|
||||
session.streamSrc.addTrack(track); // tracks previously removed.
|
||||
try{
|
||||
track.onended = function(e) { // hurrah!
|
||||
|
||||
@ -43,8 +43,29 @@
|
||||
return raw ? parseInt(raw[2], 10) : false;
|
||||
}
|
||||
|
||||
if (!getChromeVersion() || getChromeVersion < 60){
|
||||
alert("This tool really only works with recent Chromium based browsers; Firefox or Safari are not supported");
|
||||
function safariVersion() {
|
||||
try {
|
||||
var ver = navigator.appVersion.split("Version/");
|
||||
if (ver.length > 1) {
|
||||
ver = ver[1].split(" Safari");
|
||||
}
|
||||
if (ver.length > 1) {
|
||||
ver = ver[0].split(".");
|
||||
}
|
||||
if (ver.length > 1) {
|
||||
ver = parseInt(ver[0]);
|
||||
} else {
|
||||
ver = 0;
|
||||
}
|
||||
} catch (e) {
|
||||
return 0;
|
||||
}
|
||||
return ver;
|
||||
}
|
||||
|
||||
|
||||
if (!((safariVersion() && safariVersion()>=15) || (getChromeVersion() || getChromeVersion >=60))){
|
||||
alert("This tool really only works with recent Chromium based browsers; Firefox is not supported: "+ safariVersion());
|
||||
}
|
||||
|
||||
function prettyPrintJsonToId(json, element) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user