Class StreamPeerConnectionFactory
-
- All Implemented Interfaces:
public final class StreamPeerConnectionFactoryBuilds a factory that provides PeerConnections when requested.
-
-
Field Summary
Fields Modifier and Type Field Description private final EglBaseeglBase
-
Constructor Summary
Constructors Constructor Description StreamPeerConnectionFactory(Context context)
-
Method Summary
Modifier and Type Method Description final EglBasegetEglBase()Represents the EGL rendering context. final UnitsetAudioSampleCallback(Function1<JavaAudioDeviceModule.AudioSamples, Unit> callback)Set to get callbacks when audio input from microphone is received. final StreamPeerConnectionmakePeerConnection(CoroutineScope coroutineScope, PeerConnection.RTCConfiguration configuration, StreamPeerType type, MediaConstraints mediaConstraints, Function1<MediaStream, Unit> onStreamAdded, Function2<StreamPeerConnection, StreamPeerType, Unit> onNegotiationNeeded, Function2<IceCandidate, StreamPeerType, Unit> onIceCandidateRequest, Integer maxPublishingBitrate)Builds a StreamPeerConnection that wraps the WebRTC PeerConnection and exposes several helpful handlers. final VideoSourcemakeVideoSource(Boolean isScreencast)Builds a VideoSource from the factory that can be used for regular video share (camera) or screen sharing. final VideoTrackmakeVideoTrack(VideoSource source, String trackId)Builds a VideoTrack from the factory that can be used for regular video share (camera) or screen sharing. final AudioSourcemakeAudioSource(MediaConstraints constraints)Builds an AudioSource from the factory that can be used for audio sharing. final AudioTrackmakeAudioTrack(AudioSource source, String trackId)Builds an AudioTrack from the factory that can be used for regular video share (camera) or screen sharing. -
-
Constructor Detail
-
StreamPeerConnectionFactory
StreamPeerConnectionFactory(Context context)
- Parameters:
context- Used to build the underlying native components for the factory.
-
-
Method Detail
-
getEglBase
final EglBase getEglBase()
Represents the EGL rendering context.
-
setAudioSampleCallback
final Unit setAudioSampleCallback(Function1<JavaAudioDeviceModule.AudioSamples, Unit> callback)
Set to get callbacks when audio input from microphone is received. This can be example used to detect whether a person is speaking while muted.
-
makePeerConnection
final StreamPeerConnection makePeerConnection(CoroutineScope coroutineScope, PeerConnection.RTCConfiguration configuration, StreamPeerType type, MediaConstraints mediaConstraints, Function1<MediaStream, Unit> onStreamAdded, Function2<StreamPeerConnection, StreamPeerType, Unit> onNegotiationNeeded, Function2<IceCandidate, StreamPeerType, Unit> onIceCandidateRequest, Integer maxPublishingBitrate)
Builds a StreamPeerConnection that wraps the WebRTC PeerConnection and exposes several helpful handlers.
- Parameters:
coroutineScope- Scope used for asynchronous operations.configuration- The PeerConnection.RTCConfiguration used to set up the connection.type- The type of connection, either a subscriber of a publisher.mediaConstraints- Constraints used for audio and video tracks in the connection.onStreamAdded- Handler when a new MediaStream gets added.onNegotiationNeeded- Handler when there's a new negotiation.onIceCandidateRequest- Handler whenever we receive IceCandidates.
-
makeVideoSource
final VideoSource makeVideoSource(Boolean isScreencast)
Builds a VideoSource from the factory that can be used for regular video share (camera) or screen sharing.
- Parameters:
isScreencast- If we're screen sharing using this source.
-
makeVideoTrack
final VideoTrack makeVideoTrack(VideoSource source, String trackId)
Builds a VideoTrack from the factory that can be used for regular video share (camera) or screen sharing.
- Parameters:
source- The VideoSource used for the track.trackId- The unique ID for this track.
-
makeAudioSource
final AudioSource makeAudioSource(MediaConstraints constraints)
Builds an AudioSource from the factory that can be used for audio sharing.
- Parameters:
constraints- The constraints used to change the way the audio behaves.
-
makeAudioTrack
final AudioTrack makeAudioTrack(AudioSource source, String trackId)
Builds an AudioTrack from the factory that can be used for regular video share (camera) or screen sharing.
- Parameters:
source- The AudioSource used for the track.trackId- The unique ID for this track.
-
-
-
-