@@ -14372,17 +14372,32 @@ Current version indicated by LITEVER below.
1437214372 document.getElementById("addimgcontainer").classList.add("hidden");
1437314373 document.getElementById("webcamcontainer").classList.remove("hidden");
1437414374 const video = document.getElementById('webcamvideo');
14375- if(webcamStream)
14376- {
14375+
14376+ if (webcamStream) {
1437714377 stop_webcam();
1437814378 }
14379- navigator.mediaDevices.getUserMedia({ video: true })
14379+
14380+ navigator.mediaDevices.getUserMedia({
14381+ video: {
14382+ facingMode: { exact: "environment" } // Request back camera
14383+ }
14384+ })
1438014385 .then(stream => {
1438114386 webcamStream = stream;
1438214387 video.srcObject = stream;
1438314388 })
1438414389 .catch(err => {
1438514390 console.error('Error accessing webcam:', err);
14391+
14392+ // Fallback: try default camera if back camera not available
14393+ navigator.mediaDevices.getUserMedia({ video: true })
14394+ .then(fallbackStream => {
14395+ webcamStream = fallbackStream;
14396+ video.srcObject = fallbackStream;
14397+ })
14398+ .catch(fallbackErr => {
14399+ console.error('Fallback error accessing webcam:', fallbackErr);
14400+ });
1438614401 });
1438714402 }
1438814403 function stop_webcam()
@@ -19355,7 +19370,7 @@ Current version indicated by LITEVER below.
1935519370 {
1935619371 let curr = instruct_turns[i];
1935719372 let currmsg = curr.msg;
19358- if(localsettings.instruct_has_markdown && (synchro_pending_stream==""||(i+1)<instruct_turns.length))
19373+ if(localsettings.instruct_has_markdown && (localsettings.render_streaming_markdown|| synchro_pending_stream==""||(i+1)<instruct_turns.length))
1935919374 {
1936019375 //if a list has a starttag on the same line, add a newline before it
1936119376 currmsg = currmsg.replace(/(\n[-*] .+?)(%SpcStg%)/g, "$1\n$2");
0 commit comments