关于新版图传的问题
已完成private ICameraStreamManager cameraStreamManager;
private MediaDataCenter mediaDataCenter;
protected void onCreate() {
// 获取 MediaDataCenter 实例
MediaDataCenter mediaDataCenter = (MediaDataCenter) MediaDataCenter.getInstance();
// 从 MediaDataCenter 实例中获取 ICameraStreamManager 实例
cameraStreamManager = mediaDataCenter.getCameraStreamManager();
}
private void addAvailableCameraUpdatedListener(@NonNull ICameraStreamManager.AvailableCameraUpdatedListener listener) {
if (cameraStreamManager != null) {
cameraStreamManager.addAvailableCameraUpdatedListener(listener);
}
}
private void putCameraStreamSurface(@NonNull ComponentIndexType cameraIndex,
@NonNull Surface surface,
int surfaceWidth,
int surfaceHeight,
@NonNull ICameraStreamManager.ScaleType scaleType) {
if (cameraStreamManager != null) {
cameraStreamManager.putCameraStreamSurface(cameraIndex, surface, surfaceWidth, surfaceHeight, scaleType);
}
}
public void pushStreamToSurface(SurfaceTexture surfaceTexture , int i ,int i1) {
// 创建 Surface 对象,这通常是在 SurfaceTextureListener 的 onSurfaceTextureAvailable 方法中完成的
Surface surface = new Surface(surfaceTexture);
// 推送相机流到 Surface
putCameraStreamSurface(ComponentIndexType.LEFT_OR_MAIN, surface, i, i1, CENTER_INSIDE);
}
你好这是我关于图传的相关代码,我在另一个类中定义了一个TextureView的控件并设置了SurfaceTextureListener同时通过SurfaceTextureListener自带的onSurfaceTextureAvailable回调方法传给了pushStreamToSurface但是app还是不显示我的画面求解
请先登录再写评论。
评论
5 条评论