android.view.TextureView.getSurfaceTexture()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(177)

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

TextureView.getSurfaceTexture介绍

暂无

代码示例

代码示例来源:origin: vondear/RxTool

@Override
SurfaceTexture getSurfaceTexture() {
  return mTextureView.getSurfaceTexture();
}

代码示例来源:origin: google/ExoPlayer

@Override
public void setVideoTextureView(TextureView textureView) {
 verifyApplicationThread();
 removeSurfaceCallbacks();
 this.textureView = textureView;
 if (textureView == null) {
  setVideoSurfaceInternal(null, true);
  maybeNotifySurfaceSizeChanged(/* width= */ 0, /* height= */ 0);
 } else {
  if (textureView.getSurfaceTextureListener() != null) {
   Log.w(TAG, "Replacing existing SurfaceTextureListener.");
  }
  textureView.setSurfaceTextureListener(componentListener);
  SurfaceTexture surfaceTexture = textureView.isAvailable() ? textureView.getSurfaceTexture()
    : null;
  if (surfaceTexture == null) {
   setVideoSurfaceInternal(/* surface= */ null, /* ownsSurface= */ true);
   maybeNotifySurfaceSizeChanged(/* width= */ 0, /* height= */ 0);
  } else {
   setVideoSurfaceInternal(new Surface(surfaceTexture), /* ownsSurface= */ true);
   maybeNotifySurfaceSizeChanged(textureView.getWidth(), textureView.getHeight());
  }
 }
}

代码示例来源:origin: vondear/RxTool

@Override
boolean isReady() {
  return mTextureView.getSurfaceTexture() != null;
}

代码示例来源:origin: google/cameraview

@Override
boolean isReady() {
  return mTextureView.getSurfaceTexture() != null;
}

代码示例来源:origin: google/cameraview

@Override
SurfaceTexture getSurfaceTexture() {
  return mTextureView.getSurfaceTexture();
}

代码示例来源:origin: vondear/RxTool

@Override
Surface getSurface() {
  return new Surface(mTextureView.getSurfaceTexture());
}

代码示例来源:origin: google/cameraview

@Override
Surface getSurface() {
  return new Surface(mTextureView.getSurfaceTexture());
}

代码示例来源:origin: vondear/RxTool

@TargetApi(15)
@Override
void setBufferSize(int width, int height) {
  mTextureView.getSurfaceTexture().setDefaultBufferSize(width, height);
}

代码示例来源:origin: google/cameraview

@TargetApi(15)
@Override
void setBufferSize(int width, int height) {
  mTextureView.getSurfaceTexture().setDefaultBufferSize(width, height);
}

代码示例来源:origin: journeyapps/zxing-android-embedded

private void startPreviewIfReady() {
  if (currentSurfaceSize != null && previewSize != null && surfaceRect != null) {
    if (surfaceView != null && currentSurfaceSize.equals(new Size(surfaceRect.width(), surfaceRect.height()))) {
      startCameraPreview(new CameraSurface(surfaceView.getHolder()));
    } else if(textureView != null && textureView.getSurfaceTexture() != null) {
      if(previewSize != null) {
        Matrix transform = calculateTextureTransform(new Size(textureView.getWidth(), textureView.getHeight()), previewSize);
        textureView.setTransform(transform);
      }
      startCameraPreview(new CameraSurface(textureView.getSurfaceTexture()));
    } else {
      // Surface is not the correct size yet
    }
  }
}

代码示例来源:origin: journeyapps/zxing-android-embedded

/**
 * Start the camera preview and decoding. Typically this should be called from the Activity's
 * onResume() method.
 *
 * Call from UI thread only.
 */
public void resume() {
  // This must be safe to call multiple times
  Util.validateMainThread();
  Log.d(TAG, "resume()");
  // initCamera() does nothing if called twice, but does log a warning
  initCamera();
  if (currentSurfaceSize != null) {
    // The activity was paused but not stopped, so the surface still exists. Therefore
    // surfaceCreated() won't be called, so init the camera here.
    startPreviewIfReady();
  } else if(surfaceView != null) {
    // Install the callback and wait for surfaceCreated() to init the camera.
    surfaceView.getHolder().addCallback(surfaceCallback);
  } else if(textureView != null) {
    if(textureView.isAvailable()) {
      surfaceTextureListener().onSurfaceTextureAvailable(textureView.getSurfaceTexture(), textureView.getWidth(), textureView.getHeight());
    } else {
      textureView.setSurfaceTextureListener(surfaceTextureListener());
    }
  }
  // To trigger surfaceSized again
  requestLayout();
  rotationListener.listen(getContext(), rotationCallback);
}

代码示例来源:origin: RameshBhupathi/ImagePicker-OLX

@Override
SurfaceTexture getSurfaceTexture() {
  return mTextureView.getSurfaceTexture();
}

代码示例来源:origin: pedroSG94/rtmp-rtsp-stream-client-java

private Surface addPreviewSurface() {
 Surface surface = null;
 if (surfaceView != null) {
  surface = surfaceView.getHolder().getSurface();
 } else if (textureView != null) {
  final SurfaceTexture texture = textureView.getSurfaceTexture();
  surface = new Surface(texture);
 }
 return surface;
}

代码示例来源:origin: RameshBhupathi/ImagePicker-OLX

@TargetApi(15)
@Override
void setBufferSize(int width, int height) {
  mTextureView.getSurfaceTexture().setDefaultBufferSize(width, height);
}

代码示例来源:origin: mrmaffen/vlc-android-sdk

@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private void attachTextureView() {
  mTextureView.setSurfaceTextureListener(mSurfaceTextureListener);
  setSurface(new Surface(mTextureView.getSurfaceTexture()));
}

代码示例来源:origin: ymcao/YaPlayer

@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private void attachTextureView() {
  mTextureView.setSurfaceTextureListener(mSurfaceTextureListener);
  setSurface(new Surface(mTextureView.getSurfaceTexture()));
}

代码示例来源:origin: wobiancao/RtspServerAndVlcPlay

@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private void attachTextureView() {
  mTextureView.setSurfaceTextureListener(mSurfaceTextureListener);
  setSurface(new Surface(mTextureView.getSurfaceTexture()));
}

代码示例来源:origin: pedroSG94/vlc-example-streamplayer

@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private void attachTextureView() {
  mTextureView.setSurfaceTextureListener(mSurfaceTextureListener);
  setSurface(new Surface(mTextureView.getSurfaceTexture()));
}

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

@Override
  public void run() {
    if (mRestartCamera) {
      setReady(mTextureView.getSurfaceTexture(), mTextureView.getWidth(), mTextureView.getHeight());
      mRestartCamera = false;
    }
  }
});

代码示例来源:origin: square1-io/rich-text-android

public void handover(RichVideoView destination){
  destination.mMediaPlayer = mMediaPlayer;
  if(destination.mTextureView.isAvailable() == true){
    destination.mSurfaceTextureListener.onSurfaceTextureAvailable(destination.mTextureView.getSurfaceTexture(),
        destination.mTextureView.getWidth(),
        destination.mTextureView.getHeight());
  }
  destination.initMediaPlayer();
  destination.mMediaPlayer.syncMediaState();
}

相关文章