import MediaDeviceFactory from './MediaDeviceFactory' ; import MediaDeviceProxyHandler from './MediaDeviceProxyHandler' ; export default class DefaultMediaDeviceFactory implements MediaDeviceFactory { private isMediaDevicesSupported : boolean ; constructor ( ) { this . isMediaDevicesSupported = typeof navigator !== 'undefined' && ! ! navigator . mediaDevices ; } create ( ) { if ( ! this . isMediaDevicesSupported ) { throw new Error ( `navigator.mediaDevices is not supported` ) ; } else { return new Proxy < MediaDevices > ( navigator . mediaDevices , new MediaDeviceProxyHandler ( ) ) ; } } }