File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change 1+ import  {  StreamApiNotSupportedError  }  from  './errors.js' 
12import  {  imageDataFromVideo  }  from  './image-data.js' 
23import  {  hasFired  }  from  './promisify.js' 
34
@@ -22,7 +23,7 @@ class Camera {
2223
2324export  default  async  function  ( constraints ,  videoEl )  { 
2425  if  ( ! ( navigator . mediaDevices  &&  navigator . mediaDevices . getUserMedia ) )  { 
25-     throw  new  Error ( 'WebRTC API not supported in this browser' ) 
26+     throw  new  StreamApiNotSupportedError ( ) 
2627  } 
2728
2829  const  stream  =  await  navigator . mediaDevices . getUserMedia ( constraints ) 
Original file line number Diff line number Diff line change @@ -14,3 +14,11 @@ export class DropImageDecodeError extends Error {
1414    this . name  =  'DropImageDecodeError' 
1515  } 
1616} 
17+ 
18+ export  class  StreamApiNotSupportedError  extends  Error  { 
19+   constructor  ( )  { 
20+     super ( 'this browser has no Stream API support' ) 
21+ 
22+     this . name  =  'StreamApiNotSupportedError' 
23+   } 
24+ } 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments