Java Code Examples for org.webrtc.PeerConnection#createOffer()

The following examples show how to use org.webrtc.PeerConnection#createOffer() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java    From webrtc-android-tutorial with Apache License 2.0 5 votes vote down vote up
@Override
public void onPeerJoined(String socketId) {
    PeerConnection peerConnection = getOrCreatePeerConnection(socketId);
    peerConnection.createOffer(new SdpAdapter("createOfferSdp:" + socketId) {
        @Override
        public void onCreateSuccess(SessionDescription sessionDescription) {
            super.onCreateSuccess(sessionDescription);
            peerConnection.setLocalDescription(new SdpAdapter("setLocalSdp:" + socketId), sessionDescription);
            SignalingClient.get().sendSessionDescription(sessionDescription, socketId);
        }
    }, new MediaConstraints());
}
 
Example 2
Source File: VideoChatHelper.java    From Socket.io-FLSocketIM-Android with MIT License 5 votes vote down vote up
/**
 * 为所有连接创建offer
 */
private void createOffers() {

    for (Map.Entry<String, Peer> entry : peers.entrySet()) {

        Peer peer = entry.getValue();
        PeerConnection connection = peer.pc;
        FLLog.i("createoffer调用");
        connection.createOffer(peer, offerOrAnswerConstraint());
    }
}
 
Example 3
Source File: StreamDescription.java    From licodeAndroidClient with MIT License 5 votes vote down vote up
public void initLocal(PeerConnection pc, SdpObserver sdpObserver) {
	mLocal = true;
	mState = StreamState.LOCAL;
	this.pc = pc;
	mSdpConstraints = new MediaConstraints();
	mSdpConstraints.mandatory.add(new MediaConstraints.KeyValuePair(
			"OfferToReceiveAudio", "true"));
	mSdpConstraints.mandatory.add(new MediaConstraints.KeyValuePair(
			"OfferToReceiveVideo", "true"));
	pc.createOffer(sdpObserver, mSdpConstraints);
}
 
Example 4
Source File: StreamDescription.java    From licodeAndroidClient with MIT License 5 votes vote down vote up
public void initRemote(PeerConnection pc, SdpObserver sdpObserver) {
	mLocal = false;
	mState = StreamState.OPENING;
	this.pc = pc;
	mSdpConstraints = new MediaConstraints();
	mSdpConstraints.mandatory.add(new MediaConstraints.KeyValuePair(
			"OfferToReceiveAudio", "true"));
	mSdpConstraints.mandatory.add(new MediaConstraints.KeyValuePair(
			"OfferToReceiveVideo", "true"));
	pc.createOffer(sdpObserver, mSdpConstraints);
}