Class RtspMediaSource.Factory
- java.lang.Object
-
- com.google.android.exoplayer2.source.rtsp.RtspMediaSource.Factory
-
- All Implemented Interfaces:
MediaSourceFactory
- Enclosing class:
- RtspMediaSource
public static final class RtspMediaSource.Factory extends Object implements MediaSourceFactory
Factory forRtspMediaSourceThis 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 Deprecated Methods Modifier and Type Method Description RtspMediaSourcecreateMediaSource(MediaItem mediaItem)Returns a newRtspMediaSourceusing the current parameters.int[]getSupportedTypes()Returns thecontent typessupported by media sources created by this factory.RtspMediaSource.FactorysetDebugLoggingEnabled(boolean debugLoggingEnabled)Sets whether to log RTSP messages, the default value isfalse.RtspMediaSource.FactorysetDrmHttpDataSourceFactory(HttpDataSource.Factory drmHttpDataSourceFactory)Deprecated.RtspMediaSourcedoes not support DRM.RtspMediaSource.FactorysetDrmSessionManager(DrmSessionManager drmSessionManager)Deprecated.RtspMediaSourcedoes not support DRM.RtspMediaSource.FactorysetDrmSessionManagerProvider(DrmSessionManagerProvider drmSessionManager)Does nothing.RtspMediaSource.FactorysetDrmUserAgent(String userAgent)Deprecated.RtspMediaSourcedoes not support DRM.RtspMediaSource.FactorysetForceUseRtpTcp(boolean forceUseRtpTcp)Sets whether to force using TCP as the default RTP transport.RtspMediaSource.FactorysetLoadErrorHandlingPolicy(LoadErrorHandlingPolicy loadErrorHandlingPolicy)Does nothing.RtspMediaSource.FactorysetTimeoutMs(long timeoutMs)Sets the timeout in milliseconds, the default value isRtspMediaSource.DEFAULT_TIMEOUT_MS.RtspMediaSource.FactorysetUserAgent(String userAgent)Sets the user agent, the default value isExoPlayerLibraryInfo.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.MediaSourceFactory
createMediaSource, setStreamKeys
-
-
-
-
Method Detail
-
setForceUseRtpTcp
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 totrue, the source will always use TCP for streaming.- Parameters:
forceUseRtpTcp- Whether force to use TCP for streaming.- Returns:
- This Factory, for convenience.
-
setUserAgent
public RtspMediaSource.Factory setUserAgent(String userAgent)
Sets the user agent, the default value isExoPlayerLibraryInfo.VERSION_SLASHY.- Parameters:
userAgent- The user agent.- Returns:
- This Factory, for convenience.
-
setDebugLoggingEnabled
public RtspMediaSource.Factory setDebugLoggingEnabled(boolean debugLoggingEnabled)
Sets whether to log RTSP messages, the default value isfalse.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
public RtspMediaSource.Factory setTimeoutMs(@IntRange(from=1L) long timeoutMs)
Sets the timeout in milliseconds, the default value isRtspMediaSource.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 setDrmSessionManagerProvider(@Nullable DrmSessionManagerProvider drmSessionManager)
Does nothing.RtspMediaSourcedoes not support DRM.- Specified by:
setDrmSessionManagerProviderin interfaceMediaSourceFactory- Returns:
- This factory, for convenience.
-
setDrmSessionManager
@Deprecated public RtspMediaSource.Factory setDrmSessionManager(@Nullable DrmSessionManager drmSessionManager)
Deprecated.RtspMediaSourcedoes not support DRM.Does nothing.RtspMediaSourcedoes not support DRM.- Specified by:
setDrmSessionManagerin interfaceMediaSourceFactory- Parameters:
drmSessionManager- TheDrmSessionManager, ornullto use theDefaultDrmSessionManager.- Returns:
- This factory, for convenience.
-
setDrmHttpDataSourceFactory
@Deprecated public RtspMediaSource.Factory setDrmHttpDataSourceFactory(@Nullable HttpDataSource.Factory drmHttpDataSourceFactory)
Deprecated.RtspMediaSourcedoes not support DRM.Does nothing.RtspMediaSourcedoes not support DRM.- Specified by:
setDrmHttpDataSourceFactoryin interfaceMediaSourceFactory- Parameters:
drmHttpDataSourceFactory- The HTTP data source factory, ornullto useDefaultHttpDataSource.Factory.- Returns:
- This factory, for convenience.
-
setDrmUserAgent
@Deprecated public RtspMediaSource.Factory setDrmUserAgent(@Nullable String userAgent)
Deprecated.RtspMediaSourcedoes not support DRM.Does nothing.RtspMediaSourcedoes not support DRM.- Specified by:
setDrmUserAgentin interfaceMediaSourceFactory- Parameters:
userAgent- The user agent to be used for DRM requests, ornullto use the default.- Returns:
- This factory, for convenience.
-
setLoadErrorHandlingPolicy
public RtspMediaSource.Factory setLoadErrorHandlingPolicy(@Nullable LoadErrorHandlingPolicy loadErrorHandlingPolicy)
Does nothing.RtspMediaSourcedoes not support error handling policies.- Specified by:
setLoadErrorHandlingPolicyin interfaceMediaSourceFactory- Parameters:
loadErrorHandlingPolicy- ALoadErrorHandlingPolicy, ornullto use theDefaultLoadErrorHandlingPolicy.- Returns:
- This factory, for convenience.
-
getSupportedTypes
public int[] getSupportedTypes()
Description copied from interface:MediaSourceFactoryReturns thecontent typessupported by media sources created by this factory.- Specified by:
getSupportedTypesin interfaceMediaSourceFactory
-
createMediaSource
public RtspMediaSource createMediaSource(MediaItem mediaItem)
Returns a newRtspMediaSourceusing the current parameters.- Specified by:
createMediaSourcein interfaceMediaSourceFactory- Parameters:
mediaItem- TheMediaItem.- Returns:
- The new
RtspMediaSource. - Throws:
NullPointerException- ifMediaItem.localConfigurationisnull.
-
-