@@ -98,11 +98,14 @@ class Recorder extends Despot {
9898
9999 private recordingBuffer ?: Buffer | undefined ;
100100
101+ private facingMode : ConstrainDOMString ;
102+
101103 constructor ( visuals : Visuals , replay : Replay , options : VideomailClientOptions ) {
102104 super ( "Recorder" , options ) ;
103105
104106 this . visuals = visuals ;
105107 this . replay = replay ;
108+ this . facingMode = options . video . facingMode ;
106109 }
107110
108111 private writeStream ( buffer : Buffer , opts ?: WriteStreamParams ) {
@@ -1288,22 +1291,22 @@ class Recorder extends Despot {
12881291 }
12891292 }
12901293
1291- private switchFacingMode ( facingMode ?: ConstrainDOMString ) {
1294+ private switchFacingMode ( ) {
12921295 if ( ! getBrowser ( this . options ) . isMobile ( ) ) {
12931296 return ;
12941297 }
12951298
1296- let newFacingMode : ConstrainDOMString | undefined ;
1297-
1298- if ( facingMode === "user" ) {
1299- newFacingMode = "environment" ;
1300- } else if ( facingMode === "environment" ) {
1301- newFacingMode = "user" ;
1299+ if ( this . facingMode === "user" ) {
1300+ this . facingMode = "environment" ;
1301+ } else if ( this . facingMode === "environment" ) {
1302+ this . facingMode = "user" ;
13021303 } else {
1303- this . options . logger . debug ( `Recorder: unsupported facing mode ${ facingMode } ` ) ;
1304+ this . options . logger . warn (
1305+ `Recorder: unsupported facing mode ${ pretty ( this . facingMode ) } ` ,
1306+ ) ;
13041307 }
13051308
1306- this . loadGenuineUserMedia ( { switchingFacingMode : newFacingMode } ) ;
1309+ this . loadGenuineUserMedia ( { switchingFacingMode : this . facingMode } ) ;
13071310 }
13081311
13091312 private initEvents ( ) {
0 commit comments