Back to Exoplayer

RtspMediaSource.Factory (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/source/rtsp/RtspMediaSource.Factory.html

latest9.4 KB
Original Source

Package com.google.android.exoplayer2.source.rtsp

Class RtspMediaSource.Factory

  • java.lang.Object

    • com.google.android.exoplayer2.source.rtsp.RtspMediaSource.Factory
  • All Implemented Interfaces:MediaSource.Factory, MediaSourceFactoryEnclosing class:RtspMediaSource


public static final classRtspMediaSource.Factoryextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")implements[MediaSourceFactory](../MediaSourceFactory.html "interface in com.google.android.exoplayer2.source")

Factory for RtspMediaSource

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

Field Summary

- 

Fields inherited from interface com.google.android.exoplayer2.source.MediaSourceFactory

UNSUPPORTED

Constructor Summary

Constructors | Constructor | Description | | --- | --- | | Factory() | |

Method Summary

All Methods Instance Methods Concrete Methods | Modifier and Type | Method | Description | | --- | --- | --- | | RtspMediaSource | createMediaSource​(MediaItem mediaItem) | Returns a new RtspMediaSource using the current parameters. | | @com.google.android.exoplayer2.C.ContentType int[] | getSupportedTypes() | Returns the content types supported by media sources created by this factory. | | RtspMediaSource.Factory | setDebugLoggingEnabled​(boolean debugLoggingEnabled) | Sets whether to log RTSP messages, the default value is false. | | RtspMediaSource.Factory | setDrmSessionManagerProvider​(DrmSessionManagerProvider drmSessionManager) | Does nothing. | | RtspMediaSource.Factory | setForceUseRtpTcp​(boolean forceUseRtpTcp) | Sets whether to force using TCP as the default RTP transport. | | RtspMediaSource.Factory | setLoadErrorHandlingPolicy​(LoadErrorHandlingPolicy loadErrorHandlingPolicy) | Does nothing. | | RtspMediaSource.Factory | setSocketFactory​(SocketFactory socketFactory) | Sets a socket factory for RtspClient's connection, the default value is SocketFactory.getDefault(). | | RtspMediaSource.Factory | setTimeoutMs​(long timeoutMs) | Sets the timeout in milliseconds, the default value is RtspMediaSource.DEFAULT_TIMEOUT_MS. | | RtspMediaSource.Factory | setUserAgent​(String userAgent) | Sets the user agent, the default value is ExoPlayerLibraryInfo.VERSION_SLASHY. |

- 

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

- 

Methods inherited from interface com.google.android.exoplayer2.source.MediaSource.Factory

setCmcdConfigurationFactory

Constructor Detail

- 

Factory

public Factory()

Method Detail

- 

setForceUseRtpTcp

@CanIgnoreReturnValue
public[RtspMediaSource.Factory](RtspMediaSource.Factory.html "class in com.google.android.exoplayer2.source.rtsp")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.

- 

setUserAgent

@CanIgnoreReturnValue
public[RtspMediaSource.Factory](RtspMediaSource.Factory.html "class in com.google.android.exoplayer2.source.rtsp")setUserAgent​([String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")userAgent)

Sets the user agent, the default value is ExoPlayerLibraryInfo.VERSION_SLASHY. Parameters:userAgent - The user agent.Returns:This Factory, for convenience.

- 

setSocketFactory

@CanIgnoreReturnValue
public[RtspMediaSource.Factory](RtspMediaSource.Factory.html "class in com.google.android.exoplayer2.source.rtsp")setSocketFactory​([SocketFactory](https://developer.android.com/reference/javax/net/SocketFactory.html "class or interface in javax.net")socketFactory)

Sets a socket factory for RtspClient's connection, the default value is SocketFactory.getDefault(). Parameters:socketFactory - A socket factory.Returns:This Factory, for convenience.

- 

setDebugLoggingEnabled

@CanIgnoreReturnValue
public[RtspMediaSource.Factory](RtspMediaSource.Factory.html "class in com.google.android.exoplayer2.source.rtsp")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.

- 

setTimeoutMs

@CanIgnoreReturnValue
public[RtspMediaSource.Factory](RtspMediaSource.Factory.html "class in com.google.android.exoplayer2.source.rtsp")setTimeoutMs​(@IntRange(from=1L)
                                            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.

- 

setDrmSessionManagerProvider

public[RtspMediaSource.Factory](RtspMediaSource.Factory.html "class in com.google.android.exoplayer2.source.rtsp")setDrmSessionManagerProvider​([DrmSessionManagerProvider](../../drm/DrmSessionManagerProvider.html "interface in com.google.android.exoplayer2.drm")drmSessionManager)

Does nothing. RtspMediaSource does not support DRM. Specified by:setDrmSessionManagerProvider in interface MediaSource.FactoryReturns:This factory, for convenience.

- 

setLoadErrorHandlingPolicy

public[RtspMediaSource.Factory](RtspMediaSource.Factory.html "class in com.google.android.exoplayer2.source.rtsp")setLoadErrorHandlingPolicy​([LoadErrorHandlingPolicy](../../upstream/LoadErrorHandlingPolicy.html "interface in com.google.android.exoplayer2.upstream")loadErrorHandlingPolicy)

Does nothing. RtspMediaSource does not support error handling policies. Specified by:setLoadErrorHandlingPolicy in interface MediaSource.FactoryReturns:This factory, for convenience.

- 

getSupportedTypes

[@ContentType](../../C.ContentType.html "annotation in com.google.android.exoplayer2")public @com.google.android.exoplayer2.C.ContentType int[] getSupportedTypes()

Description copied from interface: MediaSource.Factory

Returns the content types supported by media sources created by this factory. Specified by:getSupportedTypes in interface MediaSource.Factory

- 

createMediaSource

public[RtspMediaSource](RtspMediaSource.html "class in com.google.android.exoplayer2.source.rtsp")createMediaSource​([MediaItem](../../MediaItem.html "class in com.google.android.exoplayer2")mediaItem)

Returns a new RtspMediaSource using the current parameters. Specified by:createMediaSource in interface MediaSource.FactoryParameters:mediaItem - The MediaItem.Returns:The new RtspMediaSource.Throws:NullPointerException - if MediaItem.localConfiguration is null.