-
Notifications
You must be signed in to change notification settings - Fork 6k
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
How to use UdpDataSource in exoplayer? #2029
Comments
Have you checked if your device supports multicast?, lots of devices don´t support multicast at all and some only for ipv6, for us, the most reliable way to test for multicast support is to check the presence of the “/proc/net/igmp” file. |
@tresvecesseis Yes, my device support multicast for ipv4 and ipv6 both. igmp and igmp6 files are there in the said directory. UDP stream is working fine on VLC Player from the same device. But I want to use ExoPlayer. Please check my code also whether I am doing right or not. If it is not the right way please guide me for corrections. |
Is there anyone who can help regarding the issue? |
This diff turns on the supporting of UDP urls. library/src/main/java/com/google/android/exoplayer2/upstream/DefaultDataSource.java index ae6f1e0..28a5b3d 100644 @@ -40,7 +40,9 @@ public final class DefaultDataSource implements DataSource { private static final String SCHEME_ASSET = "asset"; private static final String SCHEME_CONTENT = "content"; + private static final String SCHEME_UDP = "udp"; + private final DataSource udpDataSource; private final DataSource baseDataSource; private final DataSource fileDataSource; private final DataSource assetDataSource; @@ -99,6 +101,7 @@ public final class DefaultDataSource implements DataSource { this.fileDataSource = new FileDataSource(listener); this.assetDataSource = new AssetDataSource(context, listener); this.contentDataSource = new ContentDataSource(context, listener); + this.udpDataSource = new UdpDataSource(listener); } @Override @@ -116,6 +119,8 @@ public final class DefaultDataSource implements DataSource { dataSource = assetDataSource; } else if (SCHEME_CONTENT.equals(scheme)) { dataSource = contentDataSource; + } else if (SCHEME_UDP.equals(scheme)) { + dataSource = udpDataSource; } else { dataSource = baseDataSource; } |
@Avetri,Thanks for helping. Uni-casting is working fine with these modifications. But unable to multicast as it is throwing socket timeout exception. Looking forward for any lead to solve the issue. |
I could not get ExoPlayer2 to work with UDP/MPEG-TS. ExoPlayer1 (r1.5.12) works though. Which is where ExtractorSampleSource is. |
@boulaycote, it will work but for uni-casting only. Just make the changes as suggested by @Avetri. And use ExtactorMediaSource instead of HlsMediaSource. |
@SidneySeldon where can I find ExtactorMediaSource? |
@eminallen In my project its at below path. But its not fixed. It depends on your project directory structure. ExoPlayer/library/src/main/java/com/google/android/exoplayer2/source/ExtractorMediaSource.java |
@Avetri is your patch available in any of the Exoplayer releases? I was trying to use UdpDataSource class that defines Multicast socket. But not sure how to create a instance of UDPDataSource |
@msuman26 I am not sure. I have not commited it into the repo. |
UdpDataSource will be supported out-of-the-box in our next release, similar to the solution proposed in #2029 (comment). |
I tried in the way given below, but unable to open udp stream in exoplayer. Second which media source should we use for UdpDataSource, i.e., DASH, HLS, SS and Regular Media. Currently I am using SImpleExoPlayerView. Is it ok to use this view for UDP and RTMP? Should I take SurfaceView or any other view? It will be great help if someone can guide me and share the code for playing UDP and RTMP stream in ExoPlayer. I am new to exo player.
Currently I am using r2.0.3 library. Iam sending UDP stream using ffmpeg from another machine. I am getting no error. In some issues comments, I read that ExtractorSimpleSource can be used for playing UDP stream but it is not available in current version. Very keen to know the solution. Please Guide.
The text was updated successfully, but these errors were encountered: