You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adding support for url playback/transcription, including in Mobile Safari
* Renamed recognizeStream()'s data param to file, now accepts a string for urls
* New Mobile Safari-compatible example
* Simplified several other examples
Can recognize and optionally attempt to play a [File](https://developer.mozilla.org/en-US/docs/Web/API/File) or [Blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob)
86
84
(such as from an `<input type="file"/>` or from an ajax request.)
87
85
88
86
Options:
89
-
*`data`: a `Blob` or `File` instance.
87
+
*`file`: a String URL or a `Blob` or `File` instance.
90
88
*`play`: (optional, default=`false`) Attempt to also play the file locally while uploading it for transcription
91
89
* Other options passed to [RecognizeStream]
92
90
* Other options passed to [WritableElementStream] if `options.outputElement` is set
93
91
94
92
`play`requires that the browser support the format; most browsers support wav and ogg/opus, but not flac.)
95
-
Will emit a `playback-error` on the RecognizeStream if playback fails.
96
-
Playback will automatically stop when `.stop()` is called on the RecognizeStream.
93
+
Will emit an `UNSUPPORTED_FORMAT` error on the RecognizeStream if playback fails.
94
+
Playback will automatically stop when `.stop()` is called on the returned stream.
95
+
For Mobile Safari compatibility, a URL must be provided, and `recognizeFile()` must be called in direct response to a user interaction (so the token must be pre-loaded).
97
96
98
97
Pipes results through a [TimingStream] by if `options.play=true`, set `options.realtime=false` to disable.
99
98
@@ -109,6 +108,7 @@ There have been a few breaking changes in recent releases:
109
108
* Changed `playFile` option of `recognizeBlob()` to just `play`, corrected default
110
109
* Changed format of objects emitted in objectMode to exactly match what service sends. Added `ResultStrean` class and `extract_results` option to enable older behavior.
111
110
* Changed `playback-error` event to just `error` when recognizing and playing a file. Check for `error.name == 'UNSUPPORTED_FORMAT'` to identify playback errors
111
+
* Renamed `recognizeFile()`'s `data` option to `file` because it now may be a URL. Using a URL enables faster playback and mobile Safari support
112
112
113
113
See [CHANGELOG.md](CHANGELOG.md) for a complete list of changes.
0 commit comments