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


Java PeerConnectionFactory.Options方法代码示例

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


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

示例1: createPeerConnectionClient

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

示例2: WebRTC

import org.webrtc.PeerConnectionFactory; //导入方法依赖的package包/类
WebRTC(WebRTCTask task, MainActivity activity) {
	this.task = task;
	this.activity = activity;

	// Initialize Android globals
	// See https://bugs.chromium.org/p/webrtc/issues/detail?id=3416
	PeerConnectionFactory.initializeAndroidGlobals(activity, false);

	// Set ICE servers
	List<PeerConnection.IceServer> iceServers = new ArrayList<>();
	iceServers.add(new org.webrtc.PeerConnection.IceServer("stun:" + Config.STUN_SERVER));
	if (Config.TURN_SERVER != null) {
		iceServers.add(new org.webrtc.PeerConnection.IceServer("turn:" + Config.TURN_SERVER,
				Config.TURN_USER, Config.TURN_PASS));
	}

	// Create peer connection
	final PeerConnectionFactory.Options options = new PeerConnectionFactory.Options();
	this.factory = new PeerConnectionFactory(options);
	this.constraints = new MediaConstraints();
	this.pc = this.factory.createPeerConnection(iceServers, constraints, new PeerConnectionObserver());

	// Add task message event handler
	this.task.setMessageHandler(new TaskMessageHandler());
}
 
开发者ID:saltyrtc,项目名称:saltyrtc-demo,代码行数:26,代码来源:WebRTC.java

示例3: initPeerConnectionFactory

import org.webrtc.PeerConnectionFactory; //导入方法依赖的package包/类
/**
 * PeerConnection factory initialization
 */
private void initPeerConnectionFactory() {
    PeerConnectionFactory.initializeAndroidGlobals(getApplicationContext(), true);
    mOptions = new PeerConnectionFactory.Options();
    mOptions.networkIgnoreMask = 0;
    mPeerConnectionFactory = new PeerConnectionFactory(mOptions);
    Log.d(TAG, "Created PeerConnectionFactory.");
    mPeerConnectionFactory.setVideoHwAccelerationOptions(
            rootEglBase.getEglBaseContext(),
            rootEglBase.getEglBaseContext()
    );
}
 
开发者ID:crazytaxii,项目名称:Achilles_Android,代码行数:15,代码来源:MainActivity.java

示例4: testJniLoadsWithoutError

import org.webrtc.PeerConnectionFactory; //导入方法依赖的package包/类
@Test
@SmallTest
public void testJniLoadsWithoutError() throws InterruptedException {
  PeerConnectionFactory.initializeAndroidGlobals(InstrumentationRegistry.getTargetContext(),
      true /* initializeAudio */, true /* initializeVideo */,
      false /* videoCodecHwAcceleration */);

  PeerConnectionFactory.Options options = new PeerConnectionFactory.Options();
  new PeerConnectionFactory(options);
}
 
开发者ID:lgyjg,项目名称:AndroidRTC,代码行数:11,代码来源:WebRtcJniBootTest.java

示例5: start

import org.webrtc.PeerConnectionFactory; //导入方法依赖的package包/类
public void start() {
    start.setEnabled(false);
    call.setEnabled(true);
    //Initialize PeerConnectionFactory globals.
    //Params are context, initAudio,initVideo and videoCodecHwAcceleration
    PeerConnectionFactory.initializeAndroidGlobals(this, true, true, true);

    //Create a new PeerConnectionFactory instance.
    PeerConnectionFactory.Options options = new PeerConnectionFactory.Options();
    peerConnectionFactory = new PeerConnectionFactory(options);


    //Now create a VideoCapturer instance. Callback methods are there if you want to do something! Duh!
    VideoCapturer videoCapturerAndroid = getVideoCapturer(new CustomCameraEventsHandler());

    //Create MediaConstraints - Will be useful for specifying video and audio constraints.
    audioConstraints = new MediaConstraints();
    videoConstraints = new MediaConstraints();

    //Create a VideoSource instance
    videoSource = peerConnectionFactory.createVideoSource(videoCapturerAndroid);
    localVideoTrack = peerConnectionFactory.createVideoTrack("100", videoSource);

    //create an AudioSource instance
    audioSource = peerConnectionFactory.createAudioSource(audioConstraints);
    localAudioTrack = peerConnectionFactory.createAudioTrack("101", audioSource);
    localVideoView.setVisibility(View.VISIBLE);

    //create a videoRenderer based on SurfaceViewRenderer instance
    localRenderer = new VideoRenderer(localVideoView);
    // And finally, with our VideoRenderer ready, we
    // can add our renderer to the VideoTrack.
    localVideoTrack.addRenderer(localRenderer);

}
 
开发者ID:vivek1794,项目名称:webrtc-android-codelab,代码行数:36,代码来源:MainActivity.java

示例6: setPeerConnectionFactoryOptions

import org.webrtc.PeerConnectionFactory; //导入方法依赖的package包/类
public void setPeerConnectionFactoryOptions(PeerConnectionFactory.Options options) {
    this.options = options;
}
 
开发者ID:nhancv,项目名称:nc-android-webrtcpeer,代码行数:4,代码来源:PeerConnectionClient.java

示例7: setPeerConnectionFactoryOptions

import org.webrtc.PeerConnectionFactory; //导入方法依赖的package包/类
public void setPeerConnectionFactoryOptions(PeerConnectionFactory.Options options) {
  this.options = options;
}
 
开发者ID:Piasy,项目名称:AppRTC-Android,代码行数:4,代码来源:PeerConnectionClient.java

示例8: onCreate

import org.webrtc.PeerConnectionFactory; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    //Initialize PeerConnectionFactory globals.
    //Params are context, initAudio,initVideo and videoCodecHwAcceleration
    PeerConnectionFactory.initializeAndroidGlobals(this, true, true, true);

    //Create a new PeerConnectionFactory instance.
    PeerConnectionFactory.Options options = new PeerConnectionFactory.Options();
    PeerConnectionFactory peerConnectionFactory = new PeerConnectionFactory(options);


    //Now create a VideoCapturer instance. Callback methods are there if you want to do something! Duh!
    VideoCapturer videoCapturerAndroid = createVideoCapturer();
    //Create MediaConstraints - Will be useful for specifying video and audio constraints. More on this later!
    MediaConstraints constraints = new MediaConstraints();

    //Create a VideoSource instance
    VideoSource videoSource = peerConnectionFactory.createVideoSource(videoCapturerAndroid);
    VideoTrack localVideoTrack = peerConnectionFactory.createVideoTrack("100", videoSource);

    //create an AudioSource instance
    AudioSource audioSource = peerConnectionFactory.createAudioSource(constraints);
    AudioTrack localAudioTrack = peerConnectionFactory.createAudioTrack("101", audioSource);

    //we will start capturing the video from the camera
    //width,height and fps
    videoCapturerAndroid.startCapture(1000, 1000, 30);

    //create surface renderer, init it and add the renderer to the track
    SurfaceViewRenderer videoView = (SurfaceViewRenderer) findViewById(R.id.surface_rendeer);
    videoView.setMirror(true);

    EglBase rootEglBase = EglBase.create();
    videoView.init(rootEglBase.getEglBaseContext(), null);

    localVideoTrack.addRenderer(new VideoRenderer(videoView));


}
 
开发者ID:vivek1794,项目名称:webrtc-android-codelab,代码行数:43,代码来源:MainActivity.java

示例9: setPeerConnectionFactoryOptions

import org.webrtc.PeerConnectionFactory; //导入方法依赖的package包/类
public void setPeerConnectionFactoryOptions(PeerConnectionFactory.Options options) {
	this.options = options;
}
 
开发者ID:ardnezar,项目名称:webrtc-android,代码行数:4,代码来源:PeerConnectionClient.java

示例10: initializeWebRtc

import org.webrtc.PeerConnectionFactory; //导入方法依赖的package包/类
private void initializeWebRtc() {
  PeerConnectionFactory.initialize(
      PeerConnectionFactory.InitializationOptions.builder(this).createInitializationOptions()
  );
  this.webRtcFactory = new PeerConnectionFactory(new PeerConnectionFactory.Options());
}
 
开发者ID:seamlik,项目名称:viska-android,代码行数:7,代码来源:Application.java


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