@@ -699,7 +699,7 @@ const CloudRecorder = () => {
699699 uploadMetaRef . current = null ;
700700
701701 // FLAG: decide whether to close or not
702- //window.close();
702+ // window.close();
703703 return ;
704704 }
705705
@@ -727,7 +727,18 @@ const CloudRecorder = () => {
727727 isInit . current = false ;
728728
729729 // FLAG: decide whether to close or not
730- //window.close();
730+ if ( ! IS_IFRAME_CONTEXT ) {
731+ try {
732+ window . close ( ) ;
733+ } catch { }
734+ return ;
735+ }
736+ // iframe context
737+ try {
738+ window . parent . postMessage ( { type : "screenity-exit" , mode } , "*" ) ;
739+ } catch { }
740+ // fallback
741+ window . location . reload ( ) ;
731742 } ;
732743
733744 const restartRecording = async ( ) => {
@@ -1805,31 +1816,31 @@ const CloudRecorder = () => {
18051816
18061817 const startAudioStream = async ( id ) => {
18071818 const audioStreamOptions = {
1808- audio : {
1809- deviceId : id ? { exact : id } : undefined ,
1810- } ,
1819+ audio : { deviceId : id ? { exact : id } : undefined } ,
18111820 } ;
18121821
18131822 try {
1814- const stream = await navigator . mediaDevices . getUserMedia (
1815- audioStreamOptions
1816- ) ;
1817- return stream ;
1823+ return await navigator . mediaDevices . getUserMedia ( audioStreamOptions ) ;
18181824 } catch ( err ) {
18191825 console . warn (
18201826 "⚠️ Failed to access audio with deviceId, trying fallback:" ,
18211827 err
18221828 ) ;
1823-
1824- // Fallback without deviceId
18251829 try {
1826- const fallbackStream = await navigator . mediaDevices . getUserMedia ( {
1827- audio : true ,
1828- } ) ;
1829- return fallbackStream ;
1830+ return await navigator . mediaDevices . getUserMedia ( { audio : true } ) ;
18301831 } catch ( err2 ) {
1831- console . error ( "❌ Failed to access audio stream:" , err2 ) ;
1832- sendRecordingError ( "Failed to access audio stream: " + err2 . message ) ;
1832+ console . warn (
1833+ "⚠️ Microphone blocked/unavailable; continuing without mic:" ,
1834+ err2
1835+ ) ;
1836+
1837+ // Optional: small non-fatal UI signal
1838+ chrome . runtime . sendMessage ( {
1839+ type : "show-toast" ,
1840+ message :
1841+ "Microphone permission is blocked. Recording will be silent." ,
1842+ } ) ;
1843+
18331844 return null ;
18341845 }
18351846 }
@@ -1924,10 +1935,22 @@ const CloudRecorder = () => {
19241935 cameraConstraints
19251936 ) ;
19261937 } catch ( err ) {
1927- sendRecordingError (
1928- "Failed to access camera stream: " + err . message
1938+ console . warn (
1939+ "⚠️ Camera permission denied — continuing without camera:" ,
1940+ err
19291941 ) ;
1930- return ;
1942+ cameraStream . current = null ;
1943+
1944+ // keep UI consistent (optional)
1945+ await chrome . storage . local . set ( { cameraActive : false } ) ;
1946+
1947+ // only fatal if the user is doing camera-only recording
1948+ if ( data . recordingType === "camera" ) {
1949+ sendRecordingError (
1950+ "Camera permission is blocked. Please allow camera access to record."
1951+ ) ;
1952+ return ;
1953+ }
19311954 }
19321955 }
19331956
@@ -2063,10 +2086,22 @@ const CloudRecorder = () => {
20632086 cameraConstraints
20642087 ) ;
20652088 } catch ( err ) {
2066- sendRecordingError (
2067- "Failed to access camera stream: " + err . message
2089+ console . warn (
2090+ "⚠️ Camera permission denied — continuing without camera:" ,
2091+ err
20682092 ) ;
2069- return ;
2093+ cameraStream . current = null ;
2094+
2095+ // keep UI consistent (optional)
2096+ await chrome . storage . local . set ( { cameraActive : false } ) ;
2097+
2098+ // only fatal if the user is doing camera-only recording
2099+ if ( data . recordingType === "camera" ) {
2100+ sendRecordingError (
2101+ "Camera permission is blocked. Please allow camera access to record."
2102+ ) ;
2103+ return ;
2104+ }
20702105 }
20712106 }
20722107 }
0 commit comments