当前位置: 首页>>代码示例>>Java>>正文


Java CameraCapturer类代码示例

本文整理汇总了Java中com.twilio.video.CameraCapturer的典型用法代码示例。如果您正苦于以下问题:Java CameraCapturer类的具体用法?Java CameraCapturer怎么用?Java CameraCapturer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CameraCapturer类属于com.twilio.video包,在下文中一共展示了CameraCapturer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: switchCameraClickListener

import com.twilio.video.CameraCapturer; //导入依赖的package包/类
private View.OnClickListener switchCameraClickListener() {
    return new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            try {
                if (cameraCapturer != null) {
                    CameraCapturer.CameraSource cameraSource = cameraCapturer.getCameraSource();
                    cameraCapturer.switchCamera();
                    if (thumbnailVideoView.getVisibility() == View.VISIBLE) {
                        thumbnailVideoView.setMirror(cameraSource == CameraCapturer.CameraSource.BACK_CAMERA);
                    } else {
                        primaryVideoView.setMirror(cameraSource == CameraCapturer.CameraSource.BACK_CAMERA);
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    };
}
 
开发者ID:AppLozic,项目名称:Applozic-Android-Chat-Sample,代码行数:21,代码来源:VideoActivity.java

示例2: createAudioAndVideoTracks

import com.twilio.video.CameraCapturer; //导入依赖的package包/类
protected void createAudioAndVideoTracks() {
    try {
        // Share your microphone
        localAudioTrack = LocalAudioTrack.create(this, true);
        // Share your camera
        cameraCapturer = new CameraCapturer(this, CameraCapturer.CameraSource.FRONT_CAMERA);
        localVideoTrack = LocalVideoTrack.create(this, true, cameraCapturer);
        primaryVideoView.setMirror(true);
        if (videoCall) {
            localVideoTrack.addRenderer(primaryVideoView);
            localVideoView = primaryVideoView;
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:AppLozic,项目名称:Applozic-Android-Chat-Sample,代码行数:17,代码来源:AudioCallActivityV2.java

示例3: moveLocalVideoToThumbnailView

import com.twilio.video.CameraCapturer; //导入依赖的package包/类
protected void moveLocalVideoToThumbnailView() {
    try {
        if (thumbnailVideoView.getVisibility() == View.GONE) {
            thumbnailVideoView.setVisibility(View.VISIBLE);
            if (localVideoTrack != null) {
                localVideoTrack.removeRenderer(primaryVideoView);
                localVideoTrack.addRenderer(thumbnailVideoView);
                localVideoView = thumbnailVideoView;
                thumbnailVideoView.setMirror(cameraCapturer.getCameraSource() ==
                        CameraCapturer.CameraSource.FRONT_CAMERA);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:AppLozic,项目名称:Applozic-Android-Chat-Sample,代码行数:17,代码来源:AudioCallActivityV2.java

示例4: moveLocalVideoToPrimaryView

import com.twilio.video.CameraCapturer; //导入依赖的package包/类
protected void moveLocalVideoToPrimaryView() {
    try {
        if (thumbnailVideoView.getVisibility() == View.VISIBLE) {
            if (localVideoTrack != null) {
                localVideoTrack.removeRenderer(thumbnailVideoView);
                thumbnailVideoView.setVisibility(View.GONE);
                localVideoTrack.addRenderer(primaryVideoView);
                localVideoView = primaryVideoView;
                primaryVideoView.setMirror(cameraCapturer.getCameraSource() ==
                        CameraCapturer.CameraSource.FRONT_CAMERA);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:AppLozic,项目名称:Applozic-Android-Chat-Sample,代码行数:17,代码来源:AudioCallActivityV2.java

示例5: CameraCapturerCompat

import com.twilio.video.CameraCapturer; //导入依赖的package包/类
public CameraCapturerCompat(Context context,
                            CameraCapturer.CameraSource cameraSource) {
    if (Camera2Capturer.isSupported(context)) {
        setCameraPairs(context);
        camera2Capturer = new Camera2Capturer(context,
                getCameraId(cameraSource),
                camera2Listener);
    } else {
        camera1Capturer = new CameraCapturer(context, cameraSource);
    }
}
 
开发者ID:twilio,项目名称:video-quickstart-android,代码行数:12,代码来源:CameraCapturerCompat.java

示例6: getCameraSource

import com.twilio.video.CameraCapturer; //导入依赖的package包/类
public CameraCapturer.CameraSource getCameraSource() {
    if (usingCamera1()) {
        return camera1Capturer.getCameraSource();
    } else {
        return getCameraSource(camera2Capturer.getCameraId());
    }
}
 
开发者ID:twilio,项目名称:video-quickstart-android,代码行数:8,代码来源:CameraCapturerCompat.java

示例7: switchCamera

import com.twilio.video.CameraCapturer; //导入依赖的package包/类
public void switchCamera() {
    if (usingCamera1()) {
        camera1Capturer.switchCamera();
    } else {
        CameraCapturer.CameraSource cameraSource = getCameraSource(camera2Capturer
                .getCameraId());

        if (cameraSource == CameraCapturer.CameraSource.FRONT_CAMERA) {
            camera2Capturer.switchCamera(backCameraPair.second);
        } else {
            camera2Capturer.switchCamera(frontCameraPair.second);
        }
    }
}
 
开发者ID:twilio,项目名称:video-quickstart-android,代码行数:15,代码来源:CameraCapturerCompat.java

示例8: setCameraPairs

import com.twilio.video.CameraCapturer; //导入依赖的package包/类
private void setCameraPairs(Context context) {
    Camera2Enumerator camera2Enumerator = new Camera2Enumerator(context);
    for (String cameraId : camera2Enumerator.getDeviceNames()) {
        if (camera2Enumerator.isFrontFacing(cameraId)) {
            frontCameraPair = new Pair<>(CameraCapturer.CameraSource.FRONT_CAMERA, cameraId);
        }
        if (camera2Enumerator.isBackFacing(cameraId)) {
            backCameraPair = new Pair<>(CameraCapturer.CameraSource.BACK_CAMERA, cameraId);
        }
    }
}
 
开发者ID:twilio,项目名称:video-quickstart-android,代码行数:12,代码来源:CameraCapturerCompat.java

示例9: getCameraId

import com.twilio.video.CameraCapturer; //导入依赖的package包/类
private String getCameraId(CameraCapturer.CameraSource cameraSource) {
    if (frontCameraPair.first == cameraSource) {
        return frontCameraPair.second;
    } else {
        return backCameraPair.second;
    }
}
 
开发者ID:twilio,项目名称:video-quickstart-android,代码行数:8,代码来源:CameraCapturerCompat.java

示例10: createLocalTracks

import com.twilio.video.CameraCapturer; //导入依赖的package包/类
private void createLocalTracks() {
    // Share your microphone
    localAudioTrack = LocalAudioTrack.create(this, true);

    // Share your camera
    cameraCapturer = new CameraCapturer(this, getAvailableCameraSource());
    localVideoTrack = LocalVideoTrack.create(this, true, cameraCapturer);
    primaryVideoView.setMirror(true);
    localVideoTrack.addRenderer(primaryVideoView);
    localVideoView = primaryVideoView;
}
 
开发者ID:twilio,项目名称:video-quickstart-android,代码行数:12,代码来源:VideoInviteActivity.java

示例11: addVideo

import com.twilio.video.CameraCapturer; //导入依赖的package包/类
private void addVideo() {
    localVideoTrack = LocalVideoTrack.create(this, true, new CameraCapturer(this,
            CameraCapturer.CameraSource.FRONT_CAMERA, null));
    snapshotVideoRenderer = new SnapshotVideoRenderer(snapshotImageView);
    localVideoTrack.addRenderer(localVideoView);
    localVideoTrack.addRenderer(snapshotVideoRenderer);
    localVideoView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            tapForSnapshotTextView.setVisibility(View.GONE);
            snapshotVideoRenderer.takeSnapshot();
        }
    });
}
 
开发者ID:twilio,项目名称:video-quickstart-android,代码行数:15,代码来源:CustomRendererVideoActivity.java

示例12: addCameraVideo

import com.twilio.video.CameraCapturer; //导入依赖的package包/类
private void addCameraVideo() {
    cameraCapturer = new CameraCapturer(this, CameraCapturer.CameraSource.BACK_CAMERA);
    localVideoTrack = LocalVideoTrack.create(this, true, cameraCapturer);
    localVideoTrack.addRenderer(videoView);
    toggleFlashButton.setOnClickListener(toggleFlashButtonClickListener);
    takePictureButton.setOnClickListener(takePictureButtonClickListener);
}
 
开发者ID:twilio,项目名称:video-quickstart-android,代码行数:8,代码来源:AdvancedCameraCapturerActivity.java

示例13: setThumbnailMirror

import com.twilio.video.CameraCapturer; //导入依赖的package包/类
private static void setThumbnailMirror() {
    if (cameraCapturer != null) {
        CameraCapturer.CameraSource cameraSource = cameraCapturer.getCameraSource();
        final boolean isBackCamera = (cameraSource == CameraCapturer.CameraSource.BACK_CAMERA);
        if (thumbnailVideoView != null && thumbnailVideoView.getVisibility() == View.VISIBLE) {
            thumbnailVideoView.setMirror(isBackCamera);
        }
    }
}
 
开发者ID:blackuy,项目名称:react-native-twilio-video-webrtc,代码行数:10,代码来源:CustomTwilioVideoView.java

示例14: switchCamera

import com.twilio.video.CameraCapturer; //导入依赖的package包/类
public void switchCamera() {
    if (cameraCapturer != null) {
        cameraCapturer.switchCamera();
        setThumbnailMirror();
        CameraCapturer.CameraSource cameraSource = cameraCapturer.getCameraSource();
        final boolean isBackCamera = cameraSource == CameraCapturer.CameraSource.BACK_CAMERA;
        WritableMap event = new WritableNativeMap();
        event.putBoolean("isBackCamera", isBackCamera);
        pushEvent(CustomTwilioVideoView.this, ON_CAMERA_SWITCHED, event);
    }
}
 
开发者ID:blackuy,项目名称:react-native-twilio-video-webrtc,代码行数:12,代码来源:CustomTwilioVideoView.java

示例15: getAvailableCameraSource

import com.twilio.video.CameraCapturer; //导入依赖的package包/类
private CameraSource getAvailableCameraSource() {
    return (CameraCapturer.isSourceAvailable(CameraSource.FRONT_CAMERA)) ?
            (CameraSource.FRONT_CAMERA) :
            (CameraSource.BACK_CAMERA);
}
 
开发者ID:twilio,项目名称:video-quickstart-android,代码行数:6,代码来源:VideoActivity.java


注:本文中的com.twilio.video.CameraCapturer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。