-
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, Integer audioUsage, Function0<Integer> audioUsageProvider, ManagedAudioProcessingFactory audioProcessing, Function0<AudioBitrateProfile> audioBitrateProfileProvider, Function0<EglBase> sharedEglBaseProvider, Logging.Severity webRtcLoggingLevel)
-
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 UnitsetAudioRecordDataCallback(Function4<Integer, Integer, Integer, ByteBuffer, Unit> callback)Set to get callbacks when audio input from microphone is received. final BooleansetPreferredAudioInputDevice(AudioDeviceInfo deviceInfo)Sets the preferred audio input device for recording. final UnitclearPreferredAudioInputDevice()Clears the preferred audio input device, restoring default routing. final RtpCapabilitiesgetSenderCapabilities(MediaStreamTrack.MediaType mediaType)Returns the capabilities of the sender based on the mediaType. final StreamPeerConnectionmakePeerConnection(PeerConnection.RTCConfiguration configuration, StreamPeerType type, MediaConstraints mediaConstraints, Function1<MediaStream, Unit> onStreamAdded, Function2<StreamPeerConnection, StreamPeerType, Unit> onNegotiationNeeded, Function2<IceCandidate, StreamPeerType, Unit> onIceCandidateRequest, Integer maxPublishingBitrate, String debugText)Builds a StreamPeerConnection that wraps the WebRTC PeerConnection and exposes several helpful handlers. 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. final BooleanisAudioProcessingEnabled()True if the audio processing is enabled, false otherwise. final UnitsetAudioProcessingEnabled(Boolean enabled)Sets the audio processing on or off. final BooleantoggleAudioProcessing()Toggles the audio processing on and off, returning the resulting state. -
-
Constructor Detail
-
StreamPeerConnectionFactory
StreamPeerConnectionFactory(Context context, Integer audioUsage, Function0<Integer> audioUsageProvider, ManagedAudioProcessingFactory audioProcessing, Function0<AudioBitrateProfile> audioBitrateProfileProvider, Function0<EglBase> sharedEglBaseProvider, Logging.Severity webRtcLoggingLevel)
-
-
Method Detail
-
getEglBase
final EglBase getEglBase()
Represents the EGL rendering context. Todo : Remove this with the next major release
-
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.
-
setAudioRecordDataCallback
final Unit setAudioRecordDataCallback(Function4<Integer, Integer, Integer, ByteBuffer, 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.
-
setPreferredAudioInputDevice
final Boolean setPreferredAudioInputDevice(AudioDeviceInfo deviceInfo)
Sets the preferred audio input device for recording.
This allows routing audio input to a specific device, such as a USB microphone that may not be detected by AudioSwitch (e.g., Rode Wireless Go II).
- Parameters:
deviceInfo- The AudioDeviceInfo to use for recording, or null to restore default routing.
-
clearPreferredAudioInputDevice
@RequiresApi(value = 23) final Unit clearPreferredAudioInputDevice()
Clears the preferred audio input device, restoring default routing.
-
getSenderCapabilities
final RtpCapabilities getSenderCapabilities(MediaStreamTrack.MediaType mediaType)
Returns the capabilities of the sender based on the mediaType.
- Parameters:
mediaType- The type of media we're sending.
-
makePeerConnection
final StreamPeerConnection makePeerConnection(PeerConnection.RTCConfiguration configuration, StreamPeerType type, MediaConstraints mediaConstraints, Function1<MediaStream, Unit> onStreamAdded, Function2<StreamPeerConnection, StreamPeerType, Unit> onNegotiationNeeded, Function2<IceCandidate, StreamPeerType, Unit> onIceCandidateRequest, Integer maxPublishingBitrate, String debugText)
Builds a StreamPeerConnection that wraps the WebRTC PeerConnection and exposes several helpful handlers.
- Parameters:
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.
-
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.
-
isAudioProcessingEnabled
final Boolean isAudioProcessingEnabled()
True if the audio processing is enabled, false otherwise.
Returns false when the processor is not wired into the native factory — under MUSIC_HIGH_QUALITY nothing is processing this call's audio, whatever the shared module's own flag happens to say.
-
setAudioProcessingEnabled
final Unit setAudioProcessingEnabled(Boolean enabled)
Sets the audio processing on or off.
No-op when the processor is not wired into the native factory: the module is shared across calls, and a call that cannot use it must not change what other calls observe.
-
toggleAudioProcessing
final Boolean toggleAudioProcessing()
Toggles the audio processing on and off, returning the resulting state.
-
-
-
-