File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -789,12 +789,13 @@ export class WebCompat extends ContentFeature {
789
789
}
790
790
791
791
/**
792
- * Creates a valid MediaDeviceInfo object with required toJSON method
792
+ * Creates a valid MediaDeviceInfo object that passes instanceof checks
793
793
* @param {'videoinput' | 'audioinput' | 'audiooutput' } kind - The device kind
794
794
* @returns {MediaDeviceInfo }
795
795
*/
796
796
createMediaDeviceInfo ( kind ) {
797
- return {
797
+ // Create a simple object that looks like MediaDeviceInfo
798
+ const deviceInfo = {
798
799
deviceId : 'default' ,
799
800
kind : kind ,
800
801
label : '' ,
@@ -808,6 +809,19 @@ export class WebCompat extends ContentFeature {
808
809
} ;
809
810
}
810
811
} ;
812
+
813
+ // Make properties read-only to match MediaDeviceInfo behavior
814
+ Object . defineProperties ( deviceInfo , {
815
+ deviceId : { writable : false , configurable : false } ,
816
+ kind : { writable : false , configurable : false } ,
817
+ label : { writable : false , configurable : false } ,
818
+ groupId : { writable : false , configurable : false }
819
+ } ) ;
820
+
821
+ // Set the prototype to MediaDeviceInfo.prototype for instanceof checks
822
+ Object . setPrototypeOf ( deviceInfo , MediaDeviceInfo . prototype ) ;
823
+
824
+ return deviceInfo ;
811
825
}
812
826
813
827
/**
You can’t perform that action at this time.
0 commit comments