本文整理汇总了Java中android.media.MediaRecorder.MEDIA_RECORDER_INFO_MAX_FILESIZE_REACHED属性的典型用法代码示例。如果您正苦于以下问题:Java MediaRecorder.MEDIA_RECORDER_INFO_MAX_FILESIZE_REACHED属性的具体用法?Java MediaRecorder.MEDIA_RECORDER_INFO_MAX_FILESIZE_REACHED怎么用?Java MediaRecorder.MEDIA_RECORDER_INFO_MAX_FILESIZE_REACHED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.media.MediaRecorder
的用法示例。
在下文中一共展示了MediaRecorder.MEDIA_RECORDER_INFO_MAX_FILESIZE_REACHED属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onInfo
@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;
}
}
});
}
}
}
示例2: onInfo
@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();
}
final Bitmap bitmap = ThumbnailUtils.createVideoThumbnail(recordedFile, MediaStore.Video.Thumbnails.MINI_KIND);
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
onVideoTakeCallback.onFinishVideoRecording(bitmap);
}
});
}
}
示例3: onInfo
@Override
public void onInfo(MediaRecorder mediaRecorder, int what, int extra) {
if (MediaRecorder.MEDIA_RECORDER_INFO_MAX_DURATION_REACHED == what) {
onMaxDurationReached();
} else if (MediaRecorder.MEDIA_RECORDER_INFO_MAX_FILESIZE_REACHED == what) {
onMaxFileSizeReached();
}
}
示例4: onInfo
@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;
}
}
示例5: onInfo
@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();
}
}
示例6: onInfo
@Override
public void onInfo(MediaRecorder mr, int what, int extra) {
//check whether the file size has reached to 1 MB to stop recording
if (what == MediaRecorder.MEDIA_RECORDER_INFO_MAX_FILESIZE_REACHED) {
stopRecording(true);
}
}