File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 2
2
3
3
var getContentTypeFromHeader = require ( './content-type' ) ;
4
4
5
+
6
+
5
7
/**
6
8
* Reads the first few bytes of a binary file and resolves to the content-type if recognized & supported
7
9
* @param {File|Blob } file
@@ -18,7 +20,7 @@ function getContentTypeFromFile(file) {
18
20
resolve ( ct ) ;
19
21
} else {
20
22
var err = new Error ( 'Unable to determine content type from file header; only wav, flac, and ogg/opus are supported.' ) ;
21
- err . name = 'UNSUPPORTED_FORMAT' ;
23
+ err . name = FilePlayer . ERROR_UNSUPPORTED_FORMAT ;
22
24
reject ( err ) ;
23
25
}
24
26
} ;
@@ -40,7 +42,7 @@ function FilePlayer(file, contentType) {
40
42
// if we emit an error, it prevents the promise from returning the actual result
41
43
// however, most browsers do not support flac, so this is a reasonably scenario
42
44
var err = new Error ( 'Current browser is unable to play back ' + contentType ) ;
43
- err . name = 'UNSUPPORTED_FORMAT' ;
45
+ err . name = FilePlayer . ERROR_UNSUPPORTED_FORMAT ;
44
46
err . contentType = contentType ;
45
47
throw err ;
46
48
}
@@ -53,6 +55,8 @@ function FilePlayer(file, contentType) {
53
55
} ;
54
56
}
55
57
58
+ FilePlayer . ERROR_UNSUPPORTED_FORMAT = 'UNSUPPORTED_FORMAT' ;
59
+
56
60
/**
57
61
* Determines the file's content-type and then resolves to a FilePlayer instance
58
62
* @param {File|Blob } file
You can’t perform that action at this time.
0 commit comments