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


Java CameraVideoCapturer类代码示例

本文整理汇总了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);
        }
    });
}
 
开发者ID:mobilemaster128,项目名称:quickblox-android,代码行数:23,代码来源:VideoConversationFragment.java

示例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");
}
 
开发者ID:vivek1794,项目名称:webrtc-android-codelab,代码行数:20,代码来源:MainActivity.java

示例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;
}
 
开发者ID:matrix-org,项目名称:matrix-android-sdk,代码行数:31,代码来源:MXWebRtcCall.java

示例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");
    }
}
 
开发者ID:nhancv,项目名称:nc-android-webrtcpeer,代码行数:14,代码来源:PeerConnectionClient.java

示例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");
  }
}
 
开发者ID:Piasy,项目名称:AppRTC-Android,代码行数:14,代码来源:PeerConnectionClient.java

示例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);
}
 
开发者ID:QuickBlox,项目名称:q-municate-android,代码行数:37,代码来源:ConversationCallFragment.java

示例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");
  }
}
 
开发者ID:RestComm,项目名称:restcomm-android-sdk,代码行数:14,代码来源:PeerConnectionClient.java

示例8: onSwitchCamera

import org.webrtc.CameraVideoCapturer; //导入依赖的package包/类
@Override
public void onSwitchCamera(CameraVideoCapturer.CameraSwitchHandler cameraSwitchHandler) {
    ((QBRTCCameraVideoCapturer)(currentSession.getMediaStreamManager().getVideoCapturer()))
            .switchCamera(cameraSwitchHandler);
}
 
开发者ID:mobilemaster128,项目名称:quickblox-android,代码行数:6,代码来源:CallActivity.java

示例9: switchCamera

import org.webrtc.CameraVideoCapturer; //导入依赖的package包/类
public void switchCamera() {
    if (mVideoCapturer instanceof CameraVideoCapturer) {
        ((CameraVideoCapturer) mVideoCapturer).switchCamera(null);
    }
}
 
开发者ID:Piasy,项目名称:VideoCRE,代码行数:6,代码来源:VideoSource.java

示例10: onSwitchCamera

import org.webrtc.CameraVideoCapturer; //导入依赖的package包/类
void onSwitchCamera(CameraVideoCapturer.CameraSwitchHandler cameraSwitchHandler); 
开发者ID:mobilemaster128,项目名称:quickblox-android,代码行数:2,代码来源:ConversationFragmentCallbackListener.java


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