RtspMediaSource.Factory


public final class RtspMediaSource.Factory implements MediaSourceFactory


Factory for RtspMediaSource

This factory doesn't support the following methods from MediaSourceFactory:

Summary

Public constructors

Public methods

RtspMediaSource

Returns a new RtspMediaSource using the current parameters.

int[]

Returns the content types supported by media sources created by this factory.

RtspMediaSource.Factory
@CanIgnoreReturnValue
setDebugLoggingEnabled(boolean debugLoggingEnabled)

Sets whether to log RTSP messages, the default value is false.

RtspMediaSource.Factory

Does nothing.

RtspMediaSource.Factory
@CanIgnoreReturnValue
setForceUseRtpTcp(boolean forceUseRtpTcp)

Sets whether to force using TCP as the default RTP transport.

RtspMediaSource.Factory
setLoadErrorHandlingPolicy(
    LoadErrorHandlingPolicy loadErrorHandlingPolicy
)

Does nothing.

RtspMediaSource.Factory

Sets a socket factory for RtspClient's connection, the default value is getDefault.

RtspMediaSource.Factory
@CanIgnoreReturnValue
setTimeoutMs(@IntRange(from = 1) long timeoutMs)

Sets the timeout in milliseconds, the default value is DEFAULT_TIMEOUT_MS.

RtspMediaSource.Factory

Sets the user agent, the default value is VERSION_SLASHY.

Inherited methods

From androidx.media3.exoplayer.source.MediaSource.Factory
MediaSource.Factory
@UnstableApi
experimentalParseSubtitlesDuringExtraction(
    boolean parseSubtitlesDuringExtraction
)

This method is deprecated.

This method (and all support for 'legacy' subtitle decoding during rendering) will be removed in a future release.

MediaSource.Factory

Sets the CmcdConfiguration.Factory used to obtain a CmcdConfiguration for a MediaItem.

MediaSource.Factory

Sets the SubtitleParser.Factory to be used for parsing subtitles during extraction.

Public constructors

Factory

public Factory()

Public methods

createMediaSource

public RtspMediaSource createMediaSource(MediaItem mediaItem)

Returns a new RtspMediaSource using the current parameters.

Parameters
MediaItem mediaItem

The MediaItem.

Returns
RtspMediaSource

The new RtspMediaSource.

getSupportedTypes

@C.ContentType
public int[] getSupportedTypes()

Returns the content types supported by media sources created by this factory.

setDebugLoggingEnabled

@CanIgnoreReturnValue
public RtspMediaSource.Factory setDebugLoggingEnabled(boolean debugLoggingEnabled)

Sets whether to log RTSP messages, the default value is false.

This option presents a privacy risk, since it may expose sensitive information such as user's credentials.

Parameters
boolean debugLoggingEnabled

Whether to log RTSP messages.

Returns
RtspMediaSource.Factory

This Factory, for convenience.

setDrmSessionManagerProvider

public RtspMediaSource.Factory setDrmSessionManagerProvider(
    DrmSessionManagerProvider drmSessionManager
)

Does nothing. RtspMediaSource does not support DRM.

setForceUseRtpTcp

@CanIgnoreReturnValue
public RtspMediaSource.Factory setForceUseRtpTcp(boolean forceUseRtpTcp)

Sets whether to force using TCP as the default RTP transport.

The default value is false, the source will first try streaming RTSP with UDP. If no data is received on the UDP channel (for instance, when streaming behind a NAT) for a while, the source will switch to streaming using TCP. If this value is set to true, the source will always use TCP for streaming.

Parameters
boolean forceUseRtpTcp

Whether force to use TCP for streaming.

Returns
RtspMediaSource.Factory

This Factory, for convenience.

setLoadErrorHandlingPolicy

public RtspMediaSource.Factory setLoadErrorHandlingPolicy(
    LoadErrorHandlingPolicy loadErrorHandlingPolicy
)

Does nothing. RtspMediaSource does not support error handling policies.

setSocketFactory

@CanIgnoreReturnValue
public RtspMediaSource.Factory setSocketFactory(SocketFactory socketFactory)

Sets a socket factory for RtspClient's connection, the default value is getDefault.

Parameters
SocketFactory socketFactory

A socket factory.

Returns
RtspMediaSource.Factory

This Factory, for convenience.

setTimeoutMs

@CanIgnoreReturnValue
public RtspMediaSource.Factory setTimeoutMs(@IntRange(from = 1) long timeoutMs)

Sets the timeout in milliseconds, the default value is DEFAULT_TIMEOUT_MS.

A positive number of milliseconds to wait before lack of received RTP packets is treated as the end of input.

Parameters
@IntRange(from = 1) long timeoutMs

The timeout measured in milliseconds.

Returns
RtspMediaSource.Factory

This Factory, for convenience.

setUserAgent

@CanIgnoreReturnValue
public RtspMediaSource.Factory setUserAgent(String userAgent)

Sets the user agent, the default value is VERSION_SLASHY.

Parameters
String userAgent

The user agent.

Returns
RtspMediaSource.Factory

This Factory, for convenience.