Last active
April 13, 2020 08:40
-
-
Save ShwetaChauhan18/55c486d900c59a4f883ae3bc22d3f5c0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private fun startStreamingVideo() { | |
| //creating local mediastream | |
| val mediaStream = factory?.createLocalMediaStream("ARDAMS") | |
| mediaStream?.apply { | |
| addTrack(localAudioTrack) | |
| addTrack(localVideoTrack) | |
| localPeerConnection?.addStream(this) | |
| } | |
| val sdpMediaConstraints = MediaConstraints() | |
| sdpMediaConstraints.apply { | |
| mandatory.add(MediaConstraints.KeyValuePair("OfferToReceiveAudio", "true")) | |
| mandatory.add(MediaConstraints.KeyValuePair("OfferToReceiveVideo", "true")) | |
| } | |
| localPeerConnection?.createOffer(object : SimpleSdpObserver() { | |
| override fun onCreateSuccess(sessionDescription: SessionDescription) { | |
| Log.d(TAG, "onCreateSuccess: ") | |
| localPeerConnection?.setLocalDescription(SimpleSdpObserver(), sessionDescription) | |
| remotePeerConnection?.setRemoteDescription(SimpleSdpObserver(), sessionDescription) | |
| remotePeerConnection?.createAnswer(object : SimpleSdpObserver() { | |
| override fun onCreateSuccess(sessionDescription: SessionDescription) { | |
| localPeerConnection?.setRemoteDescription(SimpleSdpObserver(), sessionDescription) | |
| remotePeerConnection?.setLocalDescription(SimpleSdpObserver(), sessionDescription) | |
| } | |
| }, sdpMediaConstraints) | |
| } | |
| }, sdpMediaConstraints) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment