JvmMediaDevices

class JvmMediaDevices(audioFactory: AudioFactory = DefaultAudioFactory(), videoFactory: VideoFactory = CameraVideoFactory()) : MediaTrackFactory, AutoCloseable(source)

JVM implementation of MediaTrackFactory based dev.onvoid.webrtc.media.

Report a problem

Parameters

audioFactory

The factory for creating audio-related components. Defaults to DefaultAudioFactory.

videoFactory

The factory for creating video capture devices. Defaults to CameraVideoFactory.

Constructors

Link copied to clipboard
constructor(audioFactory: AudioFactory = DefaultAudioFactory(), videoFactory: VideoFactory = CameraVideoFactory())

Properties

Link copied to clipboard
val audioModule: AudioDeviceModuleBase

The audio device module responsible for audio input/output operations. This is provided by the configured audioFactory.

Link copied to clipboard
val peerConnectionFactory: PeerConnectionFactory

The peer connection factory used for creating WebRTC components. This is provided by the configured audioFactory.

Functions

Link copied to clipboard
open override fun close()
Link copied to clipboard

Ensures the audio recording device is started when the first audio track is created and stopped when the close() method is called, though you can stop it manually by calling audioModule.stopRecording(). Audio playout initialization should be done separately.

Link copied to clipboard

Creates a video capturer using the configured video factory, starts video capture, and creates a video track. The video capturer lifecycle is automatically managed - it will be stopped and closed when the track is disposed.