File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -139,6 +139,36 @@ class VitalLensVitalsMonitor extends VitalLensWidgetBase {
139139 }
140140 }
141141
142+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
143+ protected async handleStreamReset ( event : { message : string } ) : Promise < void > {
144+ this . statusIndicator . className = 'status-indicator status-issue' ;
145+ this . statusTextElement . textContent = 'Reconnecting...' ;
146+ this . vitalsContentElement . style . display = 'none' ;
147+ this . feedbackMessageElement . textContent =
148+ 'Connection unstable. Reconnecting...' ;
149+ this . feedbackMessageElement . style . display = 'block' ;
150+
151+ if ( this . vitalLensInstance ) {
152+ this . vitalLensInstance . stopVideoStream ( ) ;
153+ }
154+ if ( this . mediaStream ) {
155+ this . mediaStream . getTracks ( ) . forEach ( ( track ) => track . stop ( ) ) ;
156+ this . mediaStream = null ;
157+ }
158+
159+ this . isProcessingFlag = false ;
160+
161+ await new Promise ( ( resolve ) => setTimeout ( resolve , 3000 ) ) ;
162+
163+ try {
164+ await this . toggleProcessing ( ) ;
165+ } catch ( err ) {
166+ console . error ( 'Failed to automatically restart monitor:' , err ) ;
167+ this . showError ( 'Could not restart. Please click to try again.' ) ;
168+ this . resetUI ( ) ;
169+ }
170+ }
171+
142172 protected updateUI ( result : VitalLensResult ) : void {
143173 // const { heart_rate, respiratory_rate, hrv_sdnn } = result.vital_signs;
144174 // const debugLog = {
You can’t perform that action at this time.
0 commit comments