android.media.MediaRecorder.getSurface()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(410)

本文整理了Java中android.media.MediaRecorder.getSurface()方法的一些代码示例,展示了MediaRecorder.getSurface()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MediaRecorder.getSurface()方法的具体详情如下:
包路径:android.media.MediaRecorder
类名称:MediaRecorder
方法名:getSurface

MediaRecorder.getSurface介绍

暂无

代码示例

代码示例来源:origin: florent37/CameraFragment

previewRequestBuilder.addTarget(previewSurface);
workingSurface = videoRecorder.getSurface();
surfaces.add(workingSurface);
previewRequestBuilder.addTarget(workingSurface);

代码示例来源:origin: commonsguy/cw-omnibus

void start() {
 recorder=new MediaRecorder();
 recorder.setVideoSource(MediaRecorder.VideoSource.SURFACE);
 recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
 recorder.setVideoFrameRate(config.frameRate);
 recorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);
 recorder.setVideoSize(config.width, config.height);
 recorder.setVideoEncodingBitRate(config.bitRate);
 recorder.setOutputFile(output.getAbsolutePath());
 try {
  recorder.prepare();
  vdisplay=projection.createVirtualDisplay("andcorder",
   config.width, config.height, config.density,
   VIRT_DISPLAY_FLAGS, recorder.getSurface(), null, null);
  beeper.startTone(ToneGenerator.TONE_PROP_ACK);
  recorder.start();
 }
 catch (IOException e) {
  throw new RuntimeException("Exception preparing recorder", e);
 }
}

代码示例来源:origin: willowtreeapps/Hyperion-Android

private static VirtualDisplay createVirtualDisplay() {
  return mediaProjection.createVirtualDisplay("HyperionRecorder",
      displayMetrics.widthPixels, displayMetrics.heightPixels, displayMetrics.densityDpi,
      DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR,
      mediaRecorder.getSurface(), null /* Callbacks */, null /* Handler */);
}

代码示例来源:origin: guoxiaoxing/phoenix

mPreviewRequestBuilder.addTarget(previewSurface);
mWorkingSurface = mMediaRecorder.getSurface();
surfaces.add(mWorkingSurface);
mPreviewRequestBuilder.addTarget(mWorkingSurface);

代码示例来源:origin: googlesamples/android-Camera2Video

Surface recorderSurface = mMediaRecorder.getSurface();
surfaces.add(recorderSurface);
mPreviewBuilder.addTarget(recorderSurface);

代码示例来源:origin: stackoverflow.com

width, height, screenDensity,
DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR,
mMediaRecorder.getSurface(), null /*Callbacks*/, null /*Handler*/);

代码示例来源:origin: chinmoyp/screenrecorder

private VirtualDisplay createVirtualDisplay() {
  return mMediaProjection.createVirtualDisplay("MainActivity",
      DISPLAY_WIDTH, DISPLAY_HEIGHT, mScreenDensity,
      DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR,
      mMediaRecorder.getSurface(), null /*Callbacks*/, null /*Handler*/);
}

代码示例来源:origin: tyrex-team/senslogs

@Override
public void onOpened(@NonNull CameraDevice camera) {
  mCameraDevice = camera;
  try {
    camera.createCaptureSession(Collections.singletonList(mMediaRecorder.getSurface()),
        cameraCaptureSessionStateCallback, mBackgroundHandler);
  } catch (CameraAccessException e) {
    e.printStackTrace();
  }
}

代码示例来源:origin: 18Gray/ProCamera

public void startRecordVideo()
{
  if (null == mCameraDevice || !isAvailable() || null == mPreviewSize)
  {
    return;
  }
  try
  {
    isRecording = true;
    closePreviewSession();
    configureMediaRecorder();
    List<Surface> surfaces = new ArrayList<>();
    surfaces.add(surface);
    surfaces.add(mMediaRecorder.getSurface());
    mRecordVideoBuilder = CaptureRequestFactory.createRecordBuilder(mCameraDevice, surfaces);
    mCameraDevice.createCaptureSession(surfaces, recordSessionStateCallback, mBackgroundHandler);
  } catch (CameraAccessException e)
  {
    e.printStackTrace();
  }
}

代码示例来源:origin: zx391324751/weChatDemo

Surface mRecorderSurface = mediaRecorder.getSurface();
surfaces.add(mRecorderSurface);
previewBuilder.addTarget(mRecorderSurface);

代码示例来源:origin: retomeier/Wrox-ProfessionalAndroid-4E

Surface videoRecordSurface = mediaRecorder.getSurface();

代码示例来源:origin: googlecreativelab/shadercam

/**
 * Initialize all necessary components for GLES rendering, creating window surfaces for drawing
 * the preview as well as the surface that will be used by MediaRecorder for recording
 */
public void initGL() {
  mEglCore = new EglCore(null, EglCore.FLAG_RECORDABLE | EglCore.FLAG_TRY_GLES3);
  //create preview surface
  mWindowSurface = new WindowSurface(mEglCore, mSurfaceTexture);
  mWindowSurface.makeCurrent();
  //create recording surface
  mRecordSurface = new WindowSurface(mEglCore, mMediaRecorder.getSurface(), false);
  initGLComponents();
}

代码示例来源:origin: google-ar/sceneform-android-sdk

private void startRecordingVideo() {
 if (mediaRecorder == null) {
  mediaRecorder = new MediaRecorder();
 }
 try {
  buildFilename();
  setUpMediaRecorder();
 } catch (IOException e) {
  Log.e(TAG, "Exception setting up recorder", e);
  return;
 }
 // Set up Surface for the MediaRecorder
 encoderSurface = mediaRecorder.getSurface();
 sceneView.startMirroringToSurface(
   encoderSurface, 0, 0, videoSize.getWidth(), videoSize.getHeight());
 recordingVideoFlag = true;
}

代码示例来源:origin: tyrex-team/senslogs

@Override
public void onReady(@NonNull CameraCaptureSession session) {
  super.onReady(session);
  try {
    CaptureRequest.Builder builder = mCameraDevice.createCaptureRequest(
        CameraDevice.TEMPLATE_RECORD);
    builder.addTarget(mMediaRecorder.getSurface());
    builder.set(CaptureRequest.CONTROL_AF_MODE, mSettings.autoFocus.param);
    session.setRepeatingRequest(builder.build(), null, mBackgroundHandler);
    mTimestampStart = System.currentTimeMillis() / 1e3;
    mMediaRecorder.start();
  } catch (CameraAccessException e) {
    e.printStackTrace();
  }
}

代码示例来源:origin: ZhuoKeTeam/QPM

display = mediaProjection.createVirtualDisplay(QPMScreenRecorderManager.class.getSimpleName(),
      screenWidth, screenHeight, density, DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR,
      mediaRecorder.getSurface(), null, null);
  mediaRecorder.start();
} catch (Exception e){

代码示例来源:origin: mobapptuts/android_camera2_api_video_app

surfaceTexture.setDefaultBufferSize(mPreviewSize.getWidth(), mPreviewSize.getHeight());
Surface previewSurface = new Surface(surfaceTexture);
Surface recordSurface = mMediaRecorder.getSurface();
mCaptureRequestBuilder = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_RECORD);
mCaptureRequestBuilder.addTarget(previewSurface);

代码示例来源:origin: yangjie10930/OpenGL4Android

mRecorderSurface = mMediaRecorder.getSurface();
surfaces.add(mRecorderSurface);
mPreviewBuilder.addTarget(mRecorderSurface);

代码示例来源:origin: lizhifeng-sky/VideoEdit

mPreviewBuilder.addTarget(previewSurface);
Surface recorderSurface = mMediaRecorder.getSurface();
surfaces.add(recorderSurface);
mPreviewBuilder.addTarget(recorderSurface);

代码示例来源:origin: duanhong169/Camera

Surface recorderSurface = mediaRecorder.getSurface();
surfaces.add(recorderSurface);
previewRequestBuilder.addTarget(recorderSurface);

代码示例来源:origin: EzequielAdrianM/Camera2Vision

Surface recorderSurface = mMediaRecorder.getSurface();

相关文章