When MediaRecorder starts in Google Glass eye gestures are not detected anymore

StackOverflow https://stackoverflow.com/questions/22542636

  •  18-06-2023
  •  | 
  •  

سؤال

I'm trying to create a app using GDK to record a video using MediaRecorder that uses eye gestures to control it (start rec, stop rec). I'm able to use double blink to call MediaRecorder.start(), but from the moment MediaRecorder starts, I don't receive eye events anymore.

I used the code from here as the base for the video recording logic and the code from here for the eye gesture capture.

Below is the code that implements the listener to start/stop MediaRecorder:

class EyeGestureReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        mAudioManager.playSoundEffect(Sounds.SUCCESS);
        Bundle extras = intent.getExtras();

        String eyeGesture = extras.getString("gesture");
        boolean screenOff = extras.getBoolean("screen_off");

        Log.d(TAG, eyeGesture + " is detected");
        if (EyeGesture.DOUBLE_BLINK.toString().equals(eyeGesture)) {
            if (isRecording) {
                // stop recording and release camera
                ...
                isRecording = false;
            } else {
                // Camera is available and unlocked, MediaRecorder is prepared,
                // now you can start recording, startRecording will call MediaRecorder.start()
                if (startRecording()) {
                    isRecording = true;

                    // from this point I don't receive more eye events
                    // onReceive is never fired again.
                    // I've tested without calling mediaRecorder.start()
                    // and in this scenario eye events are detected without problems
                }
            }

        }  
        abortBroadcast();
    }
}

On onCreate method of my main activity I instantiate them:

mEyeGestureManager = EyeGestureManager.from(this);
mReceiver = new EyeGestureReceiver();

And on onStart:

mEyeGestureManager.enableDetectorPersistently(EyeGesture.DOUBLE_BLINK, true);
mEyeGestureManager.enableDetectorPersistently(EyeGesture.WINK, true);
IntentFilter filter = new IntentFilter("com.google.glass.action.EYE_GESTURE");
filter.setPriority(2000);

Any thoughts?

هل كانت مفيدة؟

المحلول

The EyeGesture stuff is not part of the GDK as it is not ready yet, thus bugs like this. Expect strange behaviour across the whole system if you use the,.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top