public final class

RtspMediaSource.Factory

extends java.lang.Object

implements MediaSourceFactory

 java.lang.Object

↳androidx.media3.exoplayer.rtsp.RtspMediaSource.Factory

Overview

Factory for RtspMediaSource

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

Summary

Constructors
publicFactory()

Methods
public RtspMediaSourcecreateMediaSource(MediaItem mediaItem)

Returns a new RtspMediaSource using the current parameters.

public int[]getSupportedTypes()

public RtspMediaSource.FactorysetDebugLoggingEnabled(boolean debugLoggingEnabled)

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

public RtspMediaSource.FactorysetDrmSessionManagerProvider(DrmSessionManagerProvider drmSessionManager)

Does nothing.

public RtspMediaSource.FactorysetForceUseRtpTcp(boolean forceUseRtpTcp)

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

public RtspMediaSource.FactorysetLoadErrorHandlingPolicy(LoadErrorHandlingPolicy loadErrorHandlingPolicy)

Does nothing.

public RtspMediaSource.FactorysetSocketFactory(javax.net.SocketFactory socketFactory)

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

public RtspMediaSource.FactorysetTimeoutMs(long timeoutMs)

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

public RtspMediaSource.FactorysetUserAgent(java.lang.String userAgent)

Sets the user agent, the default value is MediaLibraryInfo.VERSION_SLASHY.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public Factory()

Methods

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:

forceUseRtpTcp: Whether force to use TCP for streaming.

Returns:

This Factory, for convenience.

public RtspMediaSource.Factory setUserAgent(java.lang.String userAgent)

Sets the user agent, the default value is MediaLibraryInfo.VERSION_SLASHY.

Parameters:

userAgent: The user agent.

Returns:

This Factory, for convenience.

public RtspMediaSource.Factory setSocketFactory(javax.net.SocketFactory socketFactory)

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

Parameters:

socketFactory: A socket factory.

Returns:

This Factory, for convenience.

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:

debugLoggingEnabled: Whether to log RTSP messages.

Returns:

This Factory, for convenience.

public RtspMediaSource.Factory setTimeoutMs(long timeoutMs)

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

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

Parameters:

timeoutMs: The timeout measured in milliseconds.

Returns:

This Factory, for convenience.

public RtspMediaSource.Factory setDrmSessionManagerProvider(DrmSessionManagerProvider drmSessionManager)

Does nothing. RtspMediaSource does not support DRM.

public RtspMediaSource.Factory setLoadErrorHandlingPolicy(LoadErrorHandlingPolicy loadErrorHandlingPolicy)

Does nothing. RtspMediaSource does not support error handling policies.

public int[] getSupportedTypes()

public RtspMediaSource createMediaSource(MediaItem mediaItem)

Returns a new RtspMediaSource using the current parameters.

Parameters:

mediaItem: The MediaItem.

Returns:

The new RtspMediaSource.