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


Java PeerConnectionFactory类代码示例

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


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

示例1: onCreate

import org.webrtc.PeerConnectionFactory; //导入依赖的package包/类
@Override
public void onCreate() {
  super.onCreate();
  initializeRandomNumberFix();
  initializeLogging();
  initializeDependencyInjection();
  initializeJobManager();
  initializeExpiringMessageManager();
  initializeGcmCheck();
  initializeSignedPreKeyCheck();
  initializePeriodicTasks();
  initializeCircumvention();

  if (Build.VERSION.SDK_INT >= 11) {
    PeerConnectionFactory.initializeAndroidGlobals(this, true, true, true);
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:18,代码来源:ApplicationContext.java

示例2: 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

示例3: initializeWebRtc

import org.webrtc.PeerConnectionFactory; //导入依赖的package包/类
private void initializeWebRtc() {
  Set<String> HARDWARE_AEC_BLACKLIST = new HashSet<String>() {{
    add("Pixel");
    add("Pixel XL");
  }};

  Set<String> OPEN_SL_ES_WHITELIST = new HashSet<String>() {{
    add("Pixel");
    add("Pixel XL");
  }};

  if (Build.VERSION.SDK_INT >= 11) {
    if (HARDWARE_AEC_BLACKLIST.contains(Build.MODEL)) {
      WebRtcAudioUtils.setWebRtcBasedAcousticEchoCanceler(true);
    }

    if (!OPEN_SL_ES_WHITELIST.contains(Build.MODEL)) {
      WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(true);
    }

    PeerConnectionFactory.initializeAndroidGlobals(this, true, true, true);
  }
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:24,代码来源:ApplicationContext.java

示例4: 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

示例5: WebRtcClient

import org.webrtc.PeerConnectionFactory; //导入依赖的package包/类
public WebRtcClient(RtcListener listener, String host, PeerConnectionClient.PeerConnectionParameters params) {
    mListener = listener;
    pcParams = params;
    PeerConnectionFactory.initializeAndroidGlobals(listener, true, true,
            params.videoCodecHwAcceleration);
    factory = new PeerConnectionFactory();
    MessageHandler messageHandler = new MessageHandler();

    try {
        client = IO.socket(host);
    } catch (URISyntaxException e) {
        e.printStackTrace();
    }
    client.on("id", messageHandler.onId);
    client.on("message", messageHandler.onMessage);
    client.connect();

    iceServers.add(new PeerConnection.IceServer("stun:23.21.150.121"));
    iceServers.add(new PeerConnection.IceServer("stun:stun.l.google.com:19302"));

    pcConstraints.mandatory.add(new MediaConstraints.KeyValuePair("OfferToReceiveAudio", "true"));
    pcConstraints.mandatory.add(new MediaConstraints.KeyValuePair("OfferToReceiveVideo", "true"));
    pcConstraints.optional.add(new MediaConstraints.KeyValuePair("DtlsSrtpKeyAgreement", "true"));
}
 
开发者ID:ardnezar,项目名称:webrtc-android,代码行数:25,代码来源:WebRtcClient.java

示例6: initializeOutboundCall

import org.webrtc.PeerConnectionFactory; //导入依赖的package包/类
private void initializeOutboundCall() {
  id = UUID.randomUUID().toString();

  final Application application = (Application) getApplication();
  final PeerConnectionFactory factory = application.getWebRtcFactory();

  final MediaStream mediaStream = factory.createLocalMediaStream(UUID.randomUUID().toString());
  mediaStream.addTrack(factory.createAudioTrack(
          UUID.randomUUID().toString(),
          factory.createAudioSource(CONSTRAINTS)
  ));

  peerConnection = factory.createPeerConnection(
      application.getBuiltInIceServers(),
      CONSTRAINTS,
      new PeerConnectionObserver()
  );
  peerConnection.addStream(mediaStream);
  peerConnection.createOffer(sdpObserver, CONSTRAINTS);
}
 
开发者ID:seamlik,项目名称:viska-android,代码行数:21,代码来源:CallingActivity.java

示例7: initializeInboundCall

import org.webrtc.PeerConnectionFactory; //导入依赖的package包/类
private void initializeInboundCall() {
  id = getIntent().getStringExtra(EXTRA_SESSION_ID);

  final Application application = (Application) getApplication();
  final PeerConnectionFactory factory = application.getWebRtcFactory();

  peerConnection = factory.createPeerConnection(
      application.getBuiltInIceServers(),
      CONSTRAINTS,
      new PeerConnectionObserver()
  );
  peerConnection.setRemoteDescription(
      sdpObserver,
      new SessionDescription(
          SessionDescription.Type.OFFER,
          getIntent().getStringExtra(EXTRA_REMOTE_SDP)
      )
  );
}
 
开发者ID:seamlik,项目名称:viska-android,代码行数:20,代码来源:CallingActivity.java

示例8: createPeerConnectionFactoryInternal

import org.webrtc.PeerConnectionFactory; //导入依赖的package包/类
private void createPeerConnectionFactoryInternal(Context context) {
        Log.d(TAG, "Create peer connection peerConnectionFactory. Use video: " + peerConnectionParameters.videoCallEnabled);
//        isError = false;
        // Initialize field trials.
        String field_trials = FIELD_TRIAL_AUTOMATIC_RESIZE;
        // Check if VP9 is used by default.
        if (peerConnectionParameters.videoCallEnabled && peerConnectionParameters.videoCodec != null &&
                peerConnectionParameters.videoCodec.equals(NBMMediaConfiguration.NBMVideoCodec.VP9.toString())) {
            field_trials += FIELD_TRIAL_VP9;
        }
        PeerConnectionFactory.initializeFieldTrials(field_trials);

        if (!PeerConnectionFactory.initializeAndroidGlobals(context, true, true, peerConnectionParameters.videoCodecHwAcceleration)) {
            observer.onPeerConnectionError("Failed to initializeAndroidGlobals");
        }
        peerConnectionFactory = new PeerConnectionFactory();
        // ToDo: What about these options?
//        if (options != null) {
//            Log.d(TAG, "Factory networkIgnoreMask option: " + options.networkIgnoreMask);
//            peerConnectionFactory.setOptions(options);
//        }
        Log.d(TAG, "Peer connection peerConnectionFactory created.");
    }
 
开发者ID:nubomedia-vtt,项目名称:webrtcpeer-android,代码行数:24,代码来源:NBMWebRTCPeer.java

示例9: CargarLibreriaNativaWebRTC

import org.webrtc.PeerConnectionFactory; //导入依赖的package包/类
public void CargarLibreriaNativaWebRTC() {
    final ProgressDialog ringProgressDialog = ProgressDialog.show(MainActivity.this, "Por favor espere ...", "Mientras que se descarga la informacion del servidor ...", true);
    ringProgressDialog.setCancelable(true);

    new MainActivity().runOnUiThread(new Runnable() {
        @Override
        public void run() {
            try {
                // Here you should write your time consuming task...
                // Let the progress ring for 10 seconds...
                if (!factoryStaticInitialized)
                {
                    abortarSi(PeerConnectionFactory.initializeAndroidGlobals(MainActivity.this, true, true));
                    factoryStaticInitialized = true;
                    //Thread.sleep(200);

                }
            }
            catch (Exception e)
            {
                Log.i(TAG, "Error en funcion Iniciar Libreria: " + e.getMessage());
            }
            ringProgressDialog.dismiss();
        }
    });
}
 
开发者ID:KashaMalaga,项目名称:UMA-AndroidWebRTC,代码行数:27,代码来源:MainActivity.java

示例10: createPeerConnection

import org.webrtc.PeerConnectionFactory; //导入依赖的package包/类
private boolean createPeerConnection(Context context) {
	boolean success = false;

	if (PeerConnectionFactory.initializeAndroidGlobals(context)) {
		PeerConnectionFactory factory = new PeerConnectionFactory();
		List<IceServer> iceServers = new ArrayList<IceServer>();
		iceServers.add(new IceServer("stun:stun.l.google.com:19302"));
		// For TURN servers the format would be:
		// new IceServer("turn:url", user, password)

		MediaConstraints mediaConstraints = new MediaConstraints();
		mediaConstraints.optional.add(new MediaConstraints.KeyValuePair("DtlsSrtpKeyAgreement", "false"));
		mediaConstraints.optional.add(new MediaConstraints.KeyValuePair("RtpDataChannels", "true"));
		peerConnection = factory.createPeerConnection(iceServers, mediaConstraints, this);

		localStream = factory.createLocalMediaStream("WEBRTC_WORKSHOP_NS");
		localStream.addTrack(factory.createAudioTrack("WEBRTC_WORKSHOP_NSa1",
				factory.createAudioSource(new MediaConstraints())));
		peerConnection.addStream(localStream, new MediaConstraints());
		success = true;
	}

	return success;
}
 
开发者ID:Serchinastico,项目名称:webrtc-workshop,代码行数:25,代码来源:PeerConnectionWrapper.java

示例11: initializeAndroidGlobals

import org.webrtc.PeerConnectionFactory; //导入依赖的package包/类
/**
 * Initialize globals
 */
private static void initializeAndroidGlobals(Context context) {
    if (!mIsInitialized) {
        try {
            mIsInitialized = PeerConnectionFactory.initializeAndroidGlobals(
                    context,
                    true, // enable audio initializing
                    true, // enable video initializing
                    true  // enable hardware acceleration
            );

            PeerConnectionFactory.initializeFieldTrials(null);

            mIsSupported = true;
            Log.d(LOG_TAG, "## initializeAndroidGlobals(): mIsInitialized=" + mIsInitialized);
        } catch (Throwable e) {
            Log.e(LOG_TAG, "## initializeAndroidGlobals(): Exception Msg=" + e.getMessage());
            mIsInitialized = true;
            mIsSupported = false;
        }
    }
}
 
开发者ID:matrix-org,项目名称:matrix-android-sdk,代码行数:25,代码来源:MXWebRtcCall.java

示例12: initializeResources

import org.webrtc.PeerConnectionFactory; //导入依赖的package包/类
private void initializeResources() {
  ApplicationContext.getInstance(this).injectDependencies(this);

  this.callState             = CallState.STATE_IDLE;
  this.lockManager           = new LockManager(this);
  this.peerConnectionFactory = new PeerConnectionFactory(new PeerConnectionFactoryOptions());
  this.audioManager          = new SignalAudioManager(this);
  this.bluetoothStateManager = new BluetoothStateManager(this, this);
  this.messageSender         = messageSenderFactory.create();
  this.messageSender.setSoTimeoutMillis(TimeUnit.SECONDS.toMillis(10));
  this.accountManager.setSoTimeoutMillis(TimeUnit.SECONDS.toMillis(10));
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:13,代码来源:WebRtcCallService.java

示例13: PeerConnectionWrapper

import org.webrtc.PeerConnectionFactory; //导入依赖的package包/类
public PeerConnectionWrapper(@NonNull Context context,
                             @NonNull PeerConnectionFactory factory,
                             @NonNull PeerConnection.Observer observer,
                             @NonNull VideoRenderer.Callbacks localRenderer,
                             @NonNull List<PeerConnection.IceServer> turnServers,
                             boolean hideIp)
{
  List<PeerConnection.IceServer> iceServers = new LinkedList<>();
  iceServers.add(STUN_SERVER);
  iceServers.addAll(turnServers);

  MediaConstraints                constraints      = new MediaConstraints();
  MediaConstraints                audioConstraints = new MediaConstraints();
  PeerConnection.RTCConfiguration configuration    = new PeerConnection.RTCConfiguration(iceServers);

  configuration.bundlePolicy  = PeerConnection.BundlePolicy.MAXBUNDLE;
  configuration.rtcpMuxPolicy = PeerConnection.RtcpMuxPolicy.REQUIRE;

  if (hideIp) {
    configuration.iceTransportsType = PeerConnection.IceTransportsType.RELAY;
  }

  constraints.optional.add(new MediaConstraints.KeyValuePair("DtlsSrtpKeyAgreement", "true"));
  audioConstraints.optional.add(new MediaConstraints.KeyValuePair("DtlsSrtpKeyAgreement", "true"));

  this.peerConnection = factory.createPeerConnection(configuration, constraints, observer);
  this.videoCapturer  = createVideoCapturer(context);

  MediaStream mediaStream = factory.createLocalMediaStream("ARDAMS");
  this.audioSource = factory.createAudioSource(audioConstraints);
  this.audioTrack  = factory.createAudioTrack("ARDAMSa0", audioSource);
  this.audioTrack.setEnabled(false);
  mediaStream.addTrack(audioTrack);

  if (videoCapturer != null) {
    this.videoSource = factory.createVideoSource(videoCapturer);
    this.videoTrack = factory.createVideoTrack("ARDAMSv0", videoSource);

    this.videoTrack.addRenderer(new VideoRenderer(localRenderer));
    this.videoTrack.setEnabled(false);
    mediaStream.addTrack(videoTrack);
  } else {
    this.videoSource = null;
    this.videoTrack  = null;
  }

  this.peerConnection.addStream(mediaStream);
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:49,代码来源:PeerConnectionWrapper.java

示例14: PnPeerConnectionClient

import org.webrtc.PeerConnectionFactory; //导入依赖的package包/类
public PnPeerConnectionClient(Pubnub pubnub, PnSignalingParams signalingParams, PnRTCListener rtcListener){
    this.mPubNub = pubnub;
    this.signalingParams = signalingParams;
    this.mRtcListener = rtcListener;
    this.pcFactory = new PeerConnectionFactory(); // TODO: Check it allowed, else extra param
    this.peers = new HashMap<String, PnPeer>();
    sessionID = this.mPubNub.uuid();
    init();
}
 
开发者ID:newbie007fx,项目名称:newwebrtc,代码行数:10,代码来源:PnPeerConnectionClient.java

示例15: 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


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