File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
packages/scratch-vm/src/extensions/scratch3_face_sensing Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -219,6 +219,13 @@ class Scratch3FaceSensingBlocks {
219219 */
220220 _loop ( ) {
221221 setTimeout ( this . _loop . bind ( this ) , Math . max ( this . runtime . currentStepTime , Scratch3FaceSensingBlocks . INTERVAL ) ) ;
222+
223+ // Close the alert if the face detector is created and the video loading has either succeeded or failed.
224+ // The alert will remain open until the permissions are set
225+ if ( ! this . _firstTime && this . _videoLoadingCompleted ) {
226+ this . runtime . emit ( 'EXTENSION_DATA_LOADING' , false ) ;
227+ this . _firstTime = true ;
228+ }
222229
223230 const frame = this . runtime . ioDevices . video . getFrame ( {
224231 format : Video . FORMAT_IMAGE_DATA ,
@@ -270,7 +277,10 @@ class Scratch3FaceSensingBlocks {
270277 */
271278 getInfo ( ) {
272279 // Enable the video layer
273- this . runtime . ioDevices . video . enableVideo ( ) ;
280+ this . runtime . ioDevices . video . enableVideo ( )
281+ . finally ( ( ) => {
282+ this . _videoLoadingCompleted = true ;
283+ } ) ;
274284
275285 return {
276286 id : 'faceSensing' ,
You can’t perform that action at this time.
0 commit comments