- java.lang.Object
-
- dev.onvoid.webrtc.internal.NativeObject
-
- dev.onvoid.webrtc.internal.DisposableNativeObject
-
- dev.onvoid.webrtc.PeerConnectionFactory
-
public class PeerConnectionFactory extends dev.onvoid.webrtc.internal.DisposableNativeObjectThe PeerConnectionFactory is the main entry point for a WebRTC application. It provides factory methods forRTCPeerConnectionand audio/videoMediaStreamTracks.- Author:
- Alex Andres
-
-
Constructor Summary
Constructors Constructor Description PeerConnectionFactory()Creates an instance of PeerConnectionFactory.PeerConnectionFactory(AudioDeviceModule audioModule)Creates an instance of PeerConnectionFactory with the provided audio module.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AudioSourcecreateAudioSource(AudioOptions options)Creates anAudioSource.AudioTrackcreateAudioTrack(String label, AudioSource source)Creates an newAudioTrack.RTCPeerConnectioncreatePeerConnection(RTCConfiguration config, PeerConnectionObserver observer)Creates a newRTCPeerConnection.VideoTrackcreateVideoTrack(String label, VideoSource source)Creates a newVideoTrack.voiddispose()Invoke native object destructors and free native resources.RTCRtpCapabilitiesgetRtpReceiverCapabilities(MediaType type)Returns the capabilities of the system for receiving media of the given media type.RTCRtpCapabilitiesgetRtpSenderCapabilities(MediaType type)Returns the capabilities of the system for sending media of the given media type.
-
-
-
Constructor Detail
-
PeerConnectionFactory
public PeerConnectionFactory()
Creates an instance of PeerConnectionFactory.
-
PeerConnectionFactory
public PeerConnectionFactory(AudioDeviceModule audioModule)
Creates an instance of PeerConnectionFactory with the provided audio module.- Parameters:
audioModule- The custom audio module.
-
-
Method Detail
-
createAudioSource
public AudioSource createAudioSource(AudioOptions options)
Creates anAudioSource. The audio source may be used by one or moreAudioTracks.- Parameters:
options- Audio options to control the audio processing.- Returns:
- The created audio source.
-
createAudioTrack
public AudioTrack createAudioTrack(String label, AudioSource source)
Creates an newAudioTrack. The audio track can be added to theRTCPeerConnectionusing theaddTrackoraddTransceivermethods.- Parameters:
label- The identifier string of the audio track.source- The audio source that provides audio data.- Returns:
- The created audio track.
-
createVideoTrack
public VideoTrack createVideoTrack(String label, VideoSource source)
Creates a newVideoTrack. The video track can be added to theRTCPeerConnectionusing theaddTrackoraddTransceivermethods.- Parameters:
label- The identifier string of the video track.source- The video source that provides video data.- Returns:
- The created video track.
-
createPeerConnection
public RTCPeerConnection createPeerConnection(RTCConfiguration config, PeerConnectionObserver observer)
Creates a newRTCPeerConnection.- Parameters:
config- The peer connection configuration.observer- The observer that receives peer connection state changes.- Returns:
- The created peer connection.
-
getRtpReceiverCapabilities
public RTCRtpCapabilities getRtpReceiverCapabilities(MediaType type)
Returns the capabilities of the system for receiving media of the given media type.- Parameters:
type- The type value must be eitherAUDIOorVIDEO.- Returns:
- The supported capabilities for an
RTCRtpReceiver.
-
getRtpSenderCapabilities
public RTCRtpCapabilities getRtpSenderCapabilities(MediaType type)
Returns the capabilities of the system for sending media of the given media type.- Parameters:
type- The type value must be eitherAUDIOorVIDEO.- Returns:
- The supported capabilities for an
RTCRtpSender.
-
dispose
public void dispose()
Description copied from class:dev.onvoid.webrtc.internal.DisposableNativeObjectInvoke native object destructors and free native resources.- Specified by:
disposein classdev.onvoid.webrtc.internal.DisposableNativeObject
-
-