本文整理汇总了Java中org.webrtc.CameraVideoCapturer类的典型用法代码示例。如果您正苦于以下问题:Java CameraVideoCapturer类的具体用法?Java CameraVideoCapturer怎么用?Java CameraVideoCapturer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CameraVideoCapturer类属于org.webrtc包,在下文中一共展示了CameraVideoCapturer类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: switchCamera
import org.webrtc.CameraVideoCapturer; //导入依赖的package包/类
private void switchCamera(final MenuItem item) {
if (cameraState == CameraState.DISABLED_FROM_USER) {
return;
}
cameraToggle.setEnabled(false);
conversationFragmentCallbackListener.onSwitchCamera(new CameraVideoCapturer.CameraSwitchHandler() {
@Override
public void onCameraSwitchDone(boolean b) {
Log.d(TAG, "camera switched, bool = " + b);
isCurrentCameraFront = b;
updateSwitchCameraIcon(item);
toggleCameraInternal();
}
@Override
public void onCameraSwitchError(String s) {
Log.d(TAG, "camera switch error " + s);
Toaster.shortToast(getString(R.string.camera_swicth_failed) + s);
cameraToggle.setEnabled(true);
}
});
}
示例2: getVideoCapturer
import org.webrtc.CameraVideoCapturer; //导入依赖的package包/类
private VideoCapturer getVideoCapturer(CameraVideoCapturer.CameraEventsHandler eventsHandler) {
String[] cameraFacing = {"front", "back"};
int[] cameraIndex = {0, 1};
int[] cameraOrientation = {0, 90, 180, 270};
for (String facing : cameraFacing) {
for (int index : cameraIndex) {
for (int orientation : cameraOrientation) {
String name = "Camera " + index + ", Facing " + facing +
", Orientation " + orientation;
VideoCapturer capturer = VideoCapturerAndroid.create(name, eventsHandler);
if (capturer != null) {
Log.d("Using camera: ", name);
return capturer;
}
}
}
}
throw new RuntimeException("Failed to open capture");
}
示例3: createVideoCapturer
import org.webrtc.CameraVideoCapturer; //导入依赖的package包/类
/**
* Create the video capturer
*
* @param cameraName the selected camera name
* @return the video capturer
*/
private CameraVideoCapturer createVideoCapturer(String cameraName) {
CameraVideoCapturer cameraVideoCapturer = null;
CameraEnumerator camerasEnumerator = getCameraEnumerator(mContext);
final String[] deviceNames = camerasEnumerator.getDeviceNames();
if ((null != deviceNames) && (deviceNames.length > 0)) {
for (String name : deviceNames) {
if (name.equals(cameraName)) {
cameraVideoCapturer = camerasEnumerator.createCapturer(name, null);
if (null != cameraVideoCapturer) {
break;
}
}
}
if (null == cameraVideoCapturer) {
cameraVideoCapturer = camerasEnumerator.createCapturer(deviceNames[0], null);
}
}
return cameraVideoCapturer;
}
示例4: switchCameraInternal
import org.webrtc.CameraVideoCapturer; //导入依赖的package包/类
private void switchCameraInternal() {
if (videoCapturer instanceof CameraVideoCapturer) {
if (!videoCallEnabled || isError || videoCapturer == null) {
Log.e(TAG, "Failed to switch camera. Video: " + videoCallEnabled + ". Error : " + isError);
return; // No video is sent or only one camera is available or error happened.
}
Log.d(TAG, "Switch camera");
CameraVideoCapturer cameraVideoCapturer = (CameraVideoCapturer) videoCapturer;
cameraVideoCapturer.switchCamera(null);
} else {
Log.d(TAG, "Will not switch camera, video caputurer is not a camera");
}
}
示例5: switchCameraInternal
import org.webrtc.CameraVideoCapturer; //导入依赖的package包/类
private void switchCameraInternal() {
if (videoCapturer instanceof CameraVideoCapturer) {
if (!videoCallEnabled || isError || videoCapturer == null) {
Log.e(TAG, "Failed to switch camera. Video: " + videoCallEnabled + ". Error : " + isError);
return; // No video is sent or only one camera is available or error happened.
}
Log.d(TAG, "Switch camera");
CameraVideoCapturer cameraVideoCapturer = (CameraVideoCapturer) videoCapturer;
cameraVideoCapturer.switchCamera(null);
} else {
Log.d(TAG, "Will not switch camera, video caputurer is not a camera");
}
}
示例6: onOptionsItemSelected
import org.webrtc.CameraVideoCapturer; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
QBRTCSession currentSession = ((CallActivity) getActivity()).getCurrentSession();
if (currentSession == null) {
return super.onOptionsItemSelected(item);
}
final QBMediaStreamManager mediaStreamManager = currentSession.getMediaStreamManager();
if (mediaStreamManager == null) {
return super.onOptionsItemSelected(item);
}
switch (item.getItemId()) {
case R.id.switch_camera_toggle:
mediaStreamManager.switchCameraInput(new CameraVideoCapturer.CameraSwitchHandler() {
@Override
public void onCameraSwitchDone(boolean b) {
isFrontCameraSelected = b;
toggleCameraInternal();
}
@Override
public void onCameraSwitchError(String s) {
}
});
break;
case R.id.switch_speaker_toggle:
toggleAudioOutput();
break;
default:
return super.onOptionsItemSelected(item);
}
getActivity().invalidateOptionsMenu();
return super.onOptionsItemSelected(item);
}
示例7: switchCameraInternal
import org.webrtc.CameraVideoCapturer; //导入依赖的package包/类
private void switchCameraInternal() {
if (videoCapturer instanceof CameraVideoCapturer) {
if (!videoCallEnabled || isError) {
Log.e(TAG, "Failed to switch camera. Video: " + videoCallEnabled + ". Error : " + isError);
return; // No video is sent or only one camera is available or error happened.
}
Log.d(TAG, "Switch camera");
CameraVideoCapturer cameraVideoCapturer = (CameraVideoCapturer) videoCapturer;
cameraVideoCapturer.switchCamera(null);
} else {
Log.d(TAG, "Will not switch camera, video caputurer is not a camera");
}
}
示例8: onSwitchCamera
import org.webrtc.CameraVideoCapturer; //导入依赖的package包/类
@Override
public void onSwitchCamera(CameraVideoCapturer.CameraSwitchHandler cameraSwitchHandler) {
((QBRTCCameraVideoCapturer)(currentSession.getMediaStreamManager().getVideoCapturer()))
.switchCamera(cameraSwitchHandler);
}
示例9: switchCamera
import org.webrtc.CameraVideoCapturer; //导入依赖的package包/类
public void switchCamera() {
if (mVideoCapturer instanceof CameraVideoCapturer) {
((CameraVideoCapturer) mVideoCapturer).switchCamera(null);
}
}
示例10: onSwitchCamera
import org.webrtc.CameraVideoCapturer; //导入依赖的package包/类
void onSwitchCamera(CameraVideoCapturer.CameraSwitchHandler cameraSwitchHandler);