File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
samples/encode-decode-worker/js Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -136,9 +136,18 @@ function stop() {
136
136
stopButton . disabled = true ;
137
137
connectButton . disabled = true ;
138
138
streamWorker . postMessage ( { type : "stop" } ) ;
139
- inputStream . cancel ( ) ;
140
- outputStream . abort ( ) ;
141
- addToEventLog ( 'stop(): input stream cancelled and output stream aborted' ) ;
139
+ try {
140
+ inputStream . cancel ( ) ;
141
+ addToEventLog ( 'inputStream cancelled' ) ;
142
+ } catch ( e ) {
143
+ addToEventLog ( `Could not cancel inputStream: ${ e . message } ` ) ;
144
+ }
145
+ try {
146
+ outputStream . abort ( ) ;
147
+ addToEventLog ( 'outputStream aborted' ) ;
148
+ } catch ( e ) {
149
+ addToEventLog ( `Could not abort outputStream: ${ e . message } ` ) ;
150
+ }
142
151
}
143
152
144
153
document . addEventListener ( 'DOMContentLoaded' , async function ( event ) {
You can’t perform that action at this time.
0 commit comments