Java Code Examples for android.media.MediaRecorder#MEDIA_RECORDER_INFO_UNKNOWN

The following examples show how to use android.media.MediaRecorder#MEDIA_RECORDER_INFO_UNKNOWN . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CameraController.java    From KrGallery with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void onInfo(MediaRecorder mediaRecorder, int what, int extra) {
    if (what == MediaRecorder.MEDIA_RECORDER_INFO_MAX_DURATION_REACHED || what == MediaRecorder.MEDIA_RECORDER_INFO_MAX_FILESIZE_REACHED || what == MediaRecorder.MEDIA_RECORDER_INFO_UNKNOWN) {
        MediaRecorder tempRecorder = recorder;
        recorder = null;
        if (tempRecorder != null) {
            tempRecorder.stop();
            tempRecorder.release();
        }
        if (onVideoTakeCallback != null) {
            final Bitmap bitmap = ThumbnailUtils.createVideoThumbnail(recordedFile, MediaStore.Video.Thumbnails.MINI_KIND);
            AndroidUtilities.runOnUIThread(new Runnable() {
                @Override
                public void run() {
                    if (onVideoTakeCallback != null) {
                        onVideoTakeCallback.onFinishVideoRecording(bitmap);
                        onVideoTakeCallback = null;
                    }
                }
            });
        }
    }
}
 
Example 2
Source File: VideoRecorder.java    From VideoCamera with Apache License 2.0 6 votes vote down vote up
@Override
public void onInfo(MediaRecorder mr, int what, int extra) {
    switch (what) {
        case MediaRecorder.MEDIA_RECORDER_INFO_UNKNOWN:
            // NOP
            break;
        case MediaRecorder.MEDIA_RECORDER_INFO_MAX_DURATION_REACHED:
            CLog.d(CLog.RECORDER, "MediaRecorder max duration reached");
            stopRecording("Capture stopped - Max duration reached");
            break;
        case MediaRecorder.MEDIA_RECORDER_INFO_MAX_FILESIZE_REACHED:
            CLog.d(CLog.RECORDER, "MediaRecorder max filesize reached");
            stopRecording("Capture stopped - Max file size reached");
            break;
        default:
            break;
    }
}
 
Example 3
Source File: VideoRecorder.java    From LandscapeVideoCamera with Apache License 2.0 6 votes vote down vote up
@Override
public void onInfo(MediaRecorder mr, int what, int extra) {
    switch (what) {
        case MediaRecorder.MEDIA_RECORDER_INFO_UNKNOWN:
            // NOP
            break;
        case MediaRecorder.MEDIA_RECORDER_INFO_MAX_DURATION_REACHED:
            CLog.d(CLog.RECORDER, "MediaRecorder max duration reached");
            stopRecording("Capture stopped - Max duration reached");
            break;
        case MediaRecorder.MEDIA_RECORDER_INFO_MAX_FILESIZE_REACHED:
            CLog.d(CLog.RECORDER, "MediaRecorder max filesize reached");
            stopRecording("Capture stopped - Max file size reached");
            break;
        default:
            break;
    }
}
 
Example 4
Source File: CameraController.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onInfo(MediaRecorder mediaRecorder, int what, int extra) {
    if (what == MediaRecorder.MEDIA_RECORDER_INFO_MAX_DURATION_REACHED || what == MediaRecorder.MEDIA_RECORDER_INFO_MAX_FILESIZE_REACHED || what == MediaRecorder.MEDIA_RECORDER_INFO_UNKNOWN) {
        MediaRecorder tempRecorder = recorder;
        recorder = null;
        if (tempRecorder != null) {
            tempRecorder.stop();
            tempRecorder.release();
        }
        if (onVideoTakeCallback != null) {
            finishRecordingVideo();
        }
    }
}
 
Example 5
Source File: CameraController.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onInfo(MediaRecorder mediaRecorder, int what, int extra) {
    if (what == MediaRecorder.MEDIA_RECORDER_INFO_MAX_DURATION_REACHED || what == MediaRecorder.MEDIA_RECORDER_INFO_MAX_FILESIZE_REACHED || what == MediaRecorder.MEDIA_RECORDER_INFO_UNKNOWN) {
        MediaRecorder tempRecorder = recorder;
        recorder = null;
        if (tempRecorder != null) {
            tempRecorder.stop();
            tempRecorder.release();
        }
        if (onVideoTakeCallback != null) {
            finishRecordingVideo();
        }
    }
}
 
Example 6
Source File: CameraActivity_OldAPI.java    From microbit with Apache License 2.0 5 votes vote down vote up
@Override
public void onInfo(MediaRecorder mr, int what, int extra) {
    switch(what) {
        case MediaRecorder.MEDIA_RECORDER_INFO_MAX_DURATION_REACHED:
        case MediaRecorder.MEDIA_RECORDER_INFO_MAX_FILESIZE_REACHED:
            playAudioPresenter.setInternalPathForPlay(InternalPaths.MAX_VIDEO_RECORDED);
            playAudioPresenter.start();
            stopRecording();
            break;
        case MediaRecorder.MEDIA_RECORDER_INFO_UNKNOWN:
            logi("Error in media recorder - What = " + what + " extra = " + extra);
            stopRecording();
            break;
    }
}
 
Example 7
Source File: SoundRecorder.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
@Override
public void onInfo(MediaRecorder affectedRecorder, int what, int extra) {
  if (controller == null || affectedRecorder != controller.recorder) {
    Log.w(TAG, "onInfo called with wrong recorder. Ignoring.");
    return;
  }
  switch (what) {
  case MediaRecorder.MEDIA_RECORDER_INFO_MAX_DURATION_REACHED:
    form.dispatchErrorOccurredEvent(this, "recording",
        ErrorMessages.ERROR_SOUND_RECORDER_MAX_DURATION_REACHED);
    break;
  case MediaRecorder.MEDIA_RECORDER_INFO_MAX_FILESIZE_REACHED:
    form.dispatchErrorOccurredEvent(this, "recording",
        ErrorMessages.ERROR_SOUND_RECORDER_MAX_FILESIZE_REACHED);
    break;
  case MediaRecorder.MEDIA_RECORDER_INFO_UNKNOWN:
    form.dispatchErrorOccurredEvent(this, "recording", ErrorMessages.ERROR_SOUND_RECORDER);
    break;
  default:
    // value of `what` is not valid, probably device-specific debugging. escape early to prevent
    // stoppage until we see an Android-defined error. See also:
    // http://stackoverflow.com/questions/25785420/mediarecorder-oninfolistener-giving-an-895
    return;
  }
  try {
    Log.i(TAG, "Recoverable condition while recording. Will attempt to stop normally.");
    controller.recorder.stop();
  } catch(IllegalStateException e) {
    Log.i(TAG, "SoundRecorder was not in a recording state.", e);
    form.dispatchErrorOccurredEventDialog(this, "Stop",
        ErrorMessages.ERROR_SOUND_RECORDER_ILLEGAL_STOP);
  } finally {
    controller = null;
    StoppedRecording();
  }
}
 
Example 8
Source File: CameraController.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onInfo(MediaRecorder mediaRecorder, int what, int extra) {
    if (what == MediaRecorder.MEDIA_RECORDER_INFO_MAX_DURATION_REACHED || what == MediaRecorder.MEDIA_RECORDER_INFO_MAX_FILESIZE_REACHED || what == MediaRecorder.MEDIA_RECORDER_INFO_UNKNOWN) {
        MediaRecorder tempRecorder = recorder;
        recorder = null;
        if (tempRecorder != null) {
            tempRecorder.stop();
            tempRecorder.release();
        }
        if (onVideoTakeCallback != null) {
            finishRecordingVideo();
        }
    }
}
 
Example 9
Source File: CameraController.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onInfo(MediaRecorder mediaRecorder, int what, int extra) {
    if (what == MediaRecorder.MEDIA_RECORDER_INFO_MAX_DURATION_REACHED || what == MediaRecorder.MEDIA_RECORDER_INFO_MAX_FILESIZE_REACHED || what == MediaRecorder.MEDIA_RECORDER_INFO_UNKNOWN) {
        MediaRecorder tempRecorder = recorder;
        recorder = null;
        if (tempRecorder != null) {
            tempRecorder.stop();
            tempRecorder.release();
        }
        if (onVideoTakeCallback != null) {
            finishRecordingVideo();
        }
    }
}