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

## 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 for `RtspMediaSource`

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

  - `setDrmSessionManagerProvider(DrmSessionManagerProvider)`
  - `setDrmSessionManager(DrmSessionManager)`
  - `setDrmHttpDataSourceFactory(HttpDataSource.Factory)`
  - `setDrmUserAgent(String)`
  - `setLoadErrorHandlingPolicy(LoadErrorHandlingPolicy)`

- - ### Constructor Summary

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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `RtspMediaSource` | `createMediaSource​(MediaItem mediaItem)` | Returns a new `RtspMediaSource` using the current parameters.
    `int[]` | `getSupportedTypes()` | Returns the `content types` supported by media sources created by this factory.
    `RtspMediaSource.Factory` | `setDrmHttpDataSourceFactory​(HttpDataSource.Factory drmHttpDataSourceFactory)` | Deprecated. `RtspMediaSource` does not support DRM.
    `RtspMediaSource.Factory` | `setDrmSessionManager​(DrmSessionManager drmSessionManager)` | Deprecated. `RtspMediaSource` does not support DRM.
    `RtspMediaSource.Factory` | `setDrmSessionManagerProvider​(DrmSessionManagerProvider drmSessionManager)` | Does nothing.
    `RtspMediaSource.Factory` | `setDrmUserAgent​(String userAgent)` | Deprecated. `RtspMediaSource` does not support DRM.
    `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` | `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.MediaSourceFactory

      `createMediaSource, setStreamKeys`

- - ### Constructor Detail

    - #### Factory

          public Factory()

  - ### 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 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

          public RtspMediaSource.Factory setUserAgent​(String userAgent)

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

    - #### setDrmSessionManagerProvider

          public RtspMediaSource.Factory setDrmSessionManagerProvider​(@Nullable
                                                                      DrmSessionManagerProvider drmSessionManager)

      Does nothing. `RtspMediaSource` does not support DRM.
      Specified by:
        `setDrmSessionManagerProvider` in interface `MediaSourceFactory`
      Returns:
        This factory, for convenience.

    - #### setDrmSessionManager

          @Deprecated
          public RtspMediaSource.Factory setDrmSessionManager​(@Nullable
                                                              DrmSessionManager drmSessionManager)

      Deprecated.
      `RtspMediaSource` does not support DRM.
      Does nothing. `RtspMediaSource` does not support DRM.
      Specified by:
        `setDrmSessionManager` in interface `MediaSourceFactory`
      Parameters:
        `drmSessionManager` - The `DrmSessionManager`, or `null` to use the `DefaultDrmSessionManager`.
      Returns:
        This factory, for convenience.

    - #### setDrmHttpDataSourceFactory

          @Deprecated
          public RtspMediaSource.Factory setDrmHttpDataSourceFactory​(@Nullable
                                                                     HttpDataSource.Factory drmHttpDataSourceFactory)

      Deprecated.
      `RtspMediaSource` does not support DRM.
      Does nothing. `RtspMediaSource` does not support DRM.
      Specified by:
        `setDrmHttpDataSourceFactory` in interface `MediaSourceFactory`
      Parameters:
        `drmHttpDataSourceFactory` - The HTTP data source factory, or `null` to use `DefaultHttpDataSourceFactory`.
      Returns:
        This factory, for convenience.

    - #### setDrmUserAgent

          @Deprecated
          public RtspMediaSource.Factory setDrmUserAgent​(@Nullable
                                                         String userAgent)

      Deprecated.
      `RtspMediaSource` does not support DRM.
      Does nothing. `RtspMediaSource` does not support DRM.
      Specified by:
        `setDrmUserAgent` in interface `MediaSourceFactory`
      Parameters:
        `userAgent` - The user agent to be used for DRM requests, or `null` to use the default.
      Returns:
        This factory, for convenience.

    - #### setLoadErrorHandlingPolicy

          public RtspMediaSource.Factory setLoadErrorHandlingPolicy​(@Nullable
                                                                    LoadErrorHandlingPolicy loadErrorHandlingPolicy)

      Does nothing. `RtspMediaSource` does not support error handling policies.
      Specified by:
        `setLoadErrorHandlingPolicy` in interface `MediaSourceFactory`
      Parameters:
        `loadErrorHandlingPolicy` - A `LoadErrorHandlingPolicy`, or `null` to use the `DefaultLoadErrorHandlingPolicy`.
      Returns:
        This factory, for convenience.

    - #### getSupportedTypes

          public int[] getSupportedTypes()

      Description copied from interface: `MediaSourceFactory`
      Returns the `content types` supported by media sources created by this factory.
      Specified by:
        `getSupportedTypes` in interface `MediaSourceFactory`

    - #### createMediaSource

          public RtspMediaSource createMediaSource​(MediaItem mediaItem)

      Returns a new `RtspMediaSource` using the current parameters.
      Specified by:
        `createMediaSource` in interface `MediaSourceFactory`
      Parameters:
        `mediaItem` - The `MediaItem`.
      Returns:
        The new `RtspMediaSource`.
      Throws:
        `NullPointerException` - if `MediaItem.playbackProperties` is `null`.