CameraSrtLiveStreamer

class CameraSrtLiveStreamer(context: Context, enableAudio: Boolean = true, tsServiceInfo: TsServiceInfo = context.defaultTsServiceInfo, bitrateRegulatorFactory: IBitrateRegulatorFactory? = null, bitrateRegulatorConfig: BitrateRegulatorConfig? = null, initialOnErrorListener: OnErrorListener? = null, initialOnConnectionListener: OnConnectionListener? = null) : BaseCameraLiveStreamer, ISrtLiveStreamer

BaseCameraStreamer that sends microphones and camerao frames to a remote Secure Reliable Transport (SRT) device.

Parameters

context

application context

tsServiceInfo

MPEG-TS service description

enableAudio

Boolean.true to capture audio. False to disable audio capture.

bitrateRegulatorFactory

a IBitrateRegulatorFactory implementation. Use it to customized bitrate regulator. If bitrateRegulatorConfig is not null, bitrateRegulatorFactory must not be null.

bitrateRegulatorConfig

bitrate regulator configuration. If bitrateRegulatorFactory is not null, bitrateRegulatorConfig must not be null.

initialOnErrorListener

initialize OnErrorListener

initialOnConnectionListener

Constructors

Link copied to clipboard
constructor(context: Context, enableAudio: Boolean = true, tsServiceInfo: TsServiceInfo = context.defaultTsServiceInfo, bitrateRegulatorFactory: IBitrateRegulatorFactory? = null, bitrateRegulatorConfig: BitrateRegulatorConfig? = null, initialOnErrorListener: OnErrorListener? = null, initialOnConnectionListener: OnConnectionListener? = null)

Properties

Link copied to clipboard
open override var camera: String
Link copied to clipboard
Link copied to clipboard
open override val isConnected: Boolean
Link copied to clipboard
open override val latency: Int

Get/set bidirectional latency in milliseconds. See: SRT Socket Options

Link copied to clipboard
Link copied to clipboard
open override var onErrorListener: OnErrorListener?
Link copied to clipboard
open override var passPhrase: String

Get/set SRT passphrase. See: SRT Socket Options

Link copied to clipboard
Link copied to clipboard
open override var streamId: String

Get/set SRT stream ID. See: SRT Socket Options

Functions

Link copied to clipboard
open override fun configure(audioConfig: AudioConfig)
open override fun configure(videoConfig: VideoConfig)
open override fun configure(audioConfig: AudioConfig, videoConfig: VideoConfig)
Link copied to clipboard
open suspend override fun connect(connection: SrtConnectionDescriptor)

Connect to an SRT server with correct Live streaming parameters. To avoid creating an unresponsive UI, do not call on main thread.

open suspend override fun connect(url: String)
Link copied to clipboard
open override fun disconnect()
Link copied to clipboard
open override fun release()
Link copied to clipboard
Link copied to clipboard
open override fun startPreview(previewSurface: Surface, cameraId: String)
open fun startPreview(surfaceHolder: SurfaceHolder, cameraId: String)
open fun startPreview(surfaceView: SurfaceView, cameraId: String)
open fun startPreview(textureView: TextureView, cameraId: String)
Link copied to clipboard
open suspend override fun startStream()
open suspend override fun startStream(url: String)

Same as BaseCameraLiveStreamer.startStream but also starts bitrate regulator.

open suspend override fun startStream(connection: SrtConnectionDescriptor)

Connect to an SRT server and start stream. Same as calling connect, then startStream. To avoid creating an unresponsive UI, do not call on main thread.

Link copied to clipboard
open override fun stopPreview()
Link copied to clipboard
open suspend override fun stopStream()

Same as BaseCameraLiveStreamer.stopStream but also stops bitrate regulator.