[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enables a configurable SocketFactory for the RTSP client #9606

Merged
merged 21 commits into from
Dec 6, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
some RTSP docs
  • Loading branch information
Sebastian Roth committed Nov 2, 2021
commit b7b490326268a4a097a2c276e42474a5df52cdd4
24 changes: 24 additions & 0 deletions docs/rtsp.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,30 @@ player.prepare();
~~~
{: .language-java}

### Passing a custom SocketFactory

By default, `RtspMediaSource` will use Java's standard socket factory (`SocketFactory.getDefault()`)
to create connections to the remote endpoints. This behavior can be overridden using
`.setSocketFactory()`.

~~~
// Create an RTSP media source pointing to an RTSP uri and override the socket factory.
MediaSource mediaSource =
new RtspMediaSource.Factory()
.setSocketFactory(...)
.createMediaSource(MediaItem.fromUri(rtspUri));
// Create a player instance.
ExoPlayer player = new ExoPlayer.Builder(context).build();
// Set the media source to be played.
player.setMediaSource(mediaSource);
// Prepare the player.
player.prepare();
~~~
{: .language-java}

Custom `SocketFactory` instances can be useful when particular routing is required (e.g. when RTSP
traffic needs to pass a specific interface, or the socket needs additional connectivity flags).

## Using RTSP behind a NAT (RTP/TCP support) ##

ExoPlayer uses UDP as the default protocol for RTP transport.
Expand Down