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


Java VideoCapturer类代码示例

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


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

示例1: createVideoCapturer

import org.webrtc.VideoCapturer; //导入依赖的package包/类
private VideoCapturer createVideoCapturer() {
    VideoCapturer videoCapturer = null;
    Log.d(TAG, "Creating capturer using camera2 API.");

    // Creating camera capturer
    Camera2Enumerator enumerator = new Camera2Enumerator(this);
    final String[] deviceNames = enumerator.getDeviceNames();
    Log.d(TAG, "Looking for back facing cameras.");
    for (String deviceName : deviceNames) {
        if (enumerator.isBackFacing(deviceName)) {
            Log.d(TAG, "Creating back facing camera capturer.");
            videoCapturer = enumerator.createCapturer(deviceName, null);
            break;
        }
    }

    if (videoCapturer == null) {
        Log.e(TAG, "Failed to open camera.");
        return null;
    }
    return videoCapturer;
}
 
开发者ID:crazytaxii,项目名称:Achilles_Android,代码行数:23,代码来源:MainActivity.java

示例2: createPeerConnectionClient

import org.webrtc.VideoCapturer; //导入依赖的package包/类
PeerConnectionClient createPeerConnectionClient(MockRenderer localRenderer,
    MockRenderer remoteRenderer, PeerConnectionParameters peerConnectionParameters,
    VideoCapturer videoCapturer, EglBase.Context eglContext) {
  List<PeerConnection.IceServer> iceServers = new LinkedList<PeerConnection.IceServer>();
  SignalingParameters signalingParameters =
      new SignalingParameters(iceServers, true, // iceServers, initiator.
          null, null, null, // clientId, wssUrl, wssPostUrl.
          null, null); // offerSdp, iceCandidates.

  PeerConnectionClient client = PeerConnectionClient.getInstance();
  PeerConnectionFactory.Options options = new PeerConnectionFactory.Options();
  options.networkIgnoreMask = 0;
  options.disableNetworkMonitor = true;
  client.setPeerConnectionFactoryOptions(options);
  client.createPeerConnectionFactory(
      InstrumentationRegistry.getTargetContext(), peerConnectionParameters, this);
  client.createPeerConnection(
      eglContext, localRenderer, remoteRenderer, videoCapturer, signalingParameters);
  client.createOffer();
  return client;
}
 
开发者ID:lgyjg,项目名称:AndroidRTC,代码行数:22,代码来源:PeerConnectionClientTest.java

示例3: getVideoCapturer

import org.webrtc.VideoCapturer; //导入依赖的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

示例4: getVideoCapturer

import org.webrtc.VideoCapturer; //导入依赖的package包/类
private VideoCapturer getVideoCapturer() {
    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 = VideoCapturer.create(name);
                if (capturer != null) {
                    return capturer;
                }
            }
        }
    }
    throw new RuntimeException("Failed to open capturer");
}
 
开发者ID:actorapp,项目名称:actor-platform,代码行数:19,代码来源:AndroidVideoSource.java

示例5: addLocalStreams

import org.webrtc.VideoCapturer; //导入依赖的package包/类
private void addLocalStreams(Context context) {
    AudioManager audioManager = ((AudioManager) context.getSystemService(Context.AUDIO_SERVICE));
    // TODO(fischman): figure out how to do this Right(tm) and remove the suppression.
    @SuppressWarnings("deprecation")
    boolean isWiredHeadsetOn = audioManager.isWiredHeadsetOn();
    audioManager.setMode(isWiredHeadsetOn ? AudioManager.MODE_IN_CALL : AudioManager.MODE_IN_COMMUNICATION);
    audioManager.setSpeakerphoneOn(!isWiredHeadsetOn);

    localStream = peerConnectionFactory.createLocalMediaStream("ARDAMS");

    if (!audioOnly) {
        VideoCapturer capturer = getVideoCapturer();
        MediaConstraints videoConstraints = new MediaConstraints();
        videoSource = peerConnectionFactory.createVideoSource(capturer, videoConstraints);
        VideoTrack videoTrack = peerConnectionFactory.createVideoTrack("ARDAMSv0", videoSource);
        videoTrack.addRenderer(new VideoRenderer(localRender));
        localStream.addTrack(videoTrack);
    }

    localStream.addTrack(peerConnectionFactory.createAudioTrack("ARDAMSa0", peerConnectionFactory.createAudioSource(new MediaConstraints())));

    peerConnection.addStream(localStream);
}
 
开发者ID:respoke,项目名称:respoke-sdk-android,代码行数:24,代码来源:RespokeCall.java

示例6: getVideoCapturer

import org.webrtc.VideoCapturer; //导入依赖的package包/类
private VideoCapturer getVideoCapturer() {
    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 = VideoCapturer.create(name);
                if (capturer != null) {
                    //logAndToast("Using camera: " + name);
                    Log.d(TAG, "Using camera: " + name);
                    return capturer;
                }
            }
        }
    }
    throw new RuntimeException("Failed to open capturer");
}
 
开发者ID:respoke,项目名称:respoke-sdk-android,代码行数:21,代码来源:RespokeCall.java

示例7: getVideoCapturer

import org.webrtc.VideoCapturer; //导入依赖的package包/类
private VideoCapturer getVideoCapturer() {
  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 = VideoCapturer.create(name);
        if (capturer != null) {
          logAndToast("Using camera: " + name);
          return capturer;
        }
      }
    }
  }
  throw new RuntimeException("Failed to open capturer");
}
 
开发者ID:gaku,项目名称:WebRTCDemo,代码行数:20,代码来源:AppRTCDemoActivity.java

示例8: getVideoCapturer

import org.webrtc.VideoCapturer; //导入依赖的package包/类
/** get access to the camera */
private VideoCapturer getVideoCapturer() {
	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 = VideoCapturer.create(name);
				if (capturer != null) {
					log("Using camera: " + name);
					return capturer;
				}
			}
		}
	}
	throw new RuntimeException("Failed to open capturer");
}
 
开发者ID:K-GmbH,项目名称:licodeAndroidClient,代码行数:21,代码来源:LicodeConnector.java

示例9: createPeerConnection

import org.webrtc.VideoCapturer; //导入依赖的package包/类
public void createPeerConnection(final EglBase.Context renderEGLContext,
                                 final VideoRenderer.Callbacks localRender,
                                 final VideoRenderer.Callbacks remoteRender,
                                 final VideoCapturer videoCapturer,
                                 final SignalingParameters signalingParameters) {
    createPeerConnection(renderEGLContext, localRender, Collections.singletonList(remoteRender),
                         videoCapturer, signalingParameters);
}
 
开发者ID:nhancv,项目名称:nc-android-webrtcpeer,代码行数:9,代码来源:PeerConnectionClient.java

示例10: createVideoTrack

import org.webrtc.VideoCapturer; //导入依赖的package包/类
private VideoTrack createVideoTrack(VideoCapturer capturer) {
    videoSource = factory.createVideoSource(capturer);
    capturer.startCapture(videoWidth, videoHeight, videoFps);

    localVideoTrack = factory.createVideoTrack(VIDEO_TRACK_ID, videoSource);
    if (localRender != null) {
        localVideoTrack.setEnabled(renderVideo);
        localVideoTrack.addRenderer(new VideoRenderer(localRender));
    }

    return localVideoTrack;
}
 
开发者ID:nhancv,项目名称:nc-android-webrtcpeer,代码行数:13,代码来源:PeerConnectionClient.java

示例11: createVideoTrack

import org.webrtc.VideoCapturer; //导入依赖的package包/类
private VideoTrack createVideoTrack(VideoCapturer videoCapturer) {
    mVideoSource = mPeerConnectionFactory.createVideoSource(videoCapturer);
    videoCapturer.startCapture(videoWidth, videoHeight, videoHeight);

    mLocalVideoTrack = mPeerConnectionFactory.createVideoTrack(VIDEO_TRACK_ID, mVideoSource);
    mLocalVideoTrack.setEnabled(true);
    mLocalVideoTrack.addRenderer(new VideoRenderer(localProxyRenderer));
    return mLocalVideoTrack;
}
 
开发者ID:crazytaxii,项目名称:Achilles_Android,代码行数:10,代码来源:MainActivity.java

示例12: createVideoTrack

import org.webrtc.VideoCapturer; //导入依赖的package包/类
private VideoTrack createVideoTrack(VideoCapturer capturer) {
  videoSource = factory.createVideoSource(capturer);
  capturer.startCapture(videoWidth, videoHeight, videoFps);

  localVideoTrack = factory.createVideoTrack(VIDEO_TRACK_ID, videoSource);
  localVideoTrack.setEnabled(renderVideo);
  localVideoTrack.addSink(localRender);
  return localVideoTrack;
}
 
开发者ID:Piasy,项目名称:AppRTC-Android,代码行数:10,代码来源:PeerConnectionClient.java

示例13: createScreenCapturer

import org.webrtc.VideoCapturer; //导入依赖的package包/类
@TargetApi(21)
private VideoCapturer createScreenCapturer() {
  if (mediaProjectionPermissionResultCode != Activity.RESULT_OK) {
    reportError("User didn't give permission to capture the screen.");
    return null;
  }
  return new ScreenCapturerAndroid(
      mediaProjectionPermissionResultData, new MediaProjection.Callback() {
    @Override
    public void onStop() {
      reportError("User revoked permission to capture the screen.");
    }
  });
}
 
开发者ID:Piasy,项目名称:AppRTC-Android,代码行数:15,代码来源:CallActivity.java

示例14: onConnectedToRoomInternal

import org.webrtc.VideoCapturer; //导入依赖的package包/类
private void onConnectedToRoomInternal(final SignalingParameters params) {
  final long delta = System.currentTimeMillis() - callStartedTimeMs;

  signalingParameters = params;
  logAndToast("Creating peer connection, delay=" + delta + "ms");
  VideoCapturer videoCapturer = null;
  if (peerConnectionParameters.videoCallEnabled) {
    videoCapturer = createVideoCapturer();
  }
  peerConnectionClient.createPeerConnection(
      localProxyVideoSink, remoteRenderers, videoCapturer, signalingParameters);

  if (signalingParameters.initiator) {
    logAndToast("Creating OFFER...");
    // Create offer. Offer SDP will be sent to answering client in
    // PeerConnectionEvents.onLocalDescription event.
    peerConnectionClient.createOffer();
  } else {
    if (params.offerSdp != null) {
      peerConnectionClient.setRemoteDescription(params.offerSdp);
      logAndToast("Creating ANSWER...");
      // Create answer. Answer SDP will be sent to offering client in
      // PeerConnectionEvents.onLocalDescription event.
      peerConnectionClient.createAnswer();
    }
    if (params.iceCandidates != null) {
      // Add remote ICE candidates from room.
      for (IceCandidate iceCandidate : params.iceCandidates) {
        peerConnectionClient.addRemoteIceCandidate(iceCandidate);
      }
    }
  }
}
 
开发者ID:Piasy,项目名称:AppRTC-Android,代码行数:34,代码来源:CallActivity.java

示例15: createVideoTrack

import org.webrtc.VideoCapturer; //导入依赖的package包/类
private VideoTrack createVideoTrack(VideoCapturer capturer) {
    videoSource = factory.createVideoSource(capturer);
    capturer.startCapture(videoWidth, videoHeight, videoFps);

    localVideoTrack = factory.createVideoTrack(VIDEO_TRACK_ID, videoSource);
    localVideoTrack.setEnabled(renderVideo);
    localVideoTrack.addRenderer(new VideoRenderer(localRender));
    return localVideoTrack;
}
 
开发者ID:lgyjg,项目名称:AndroidRTC,代码行数:10,代码来源:PeerConnectionClient.java


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