Reputation: 311
I'm using Adobe Live Stream Encoder
to stream RTMP
live audio in server side.
in my android client app, ExoPlayer
with RTMP Extension can't play it and causes RtmpIOException
but I can play it with VLC or MPC.
I tested my android app with some other RTMP
links and it was Ok.
I also used this url in other video players installed in my phone (MxPlayer, Vlc) and it was Ok.
this is the code in android for playing video:
BandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
TrackSelection.Factory videoTrackSelectionFactory = new AdaptiveTrackSelection.Factory();
TrackSelector trackSelector = new DefaultTrackSelector(videoTrackSelectionFactory);
//Create the player
player = ExoPlayerFactory.newSimpleInstance(this, trackSelector);
playerView.setPlayer(player);
MediaSource videoSource = null;
Uri uri = Uri.parse("rtmp://172.18.49.6/live/11");
dataSourceFactory = new RtmpDataSourceFactory();
videoSource = new ExtractorMediaSource.Factory(dataSourceFactory)
.createMediaSource(uri);
player.prepare(videoSource);
player.setPlayWhenReady(true);
And this is the exception:
E/ExoPlayerImplInternal: Source error.
net.butterflytv.rtmp_client.RtmpClient$RtmpIOException
at net.butterflytv.rtmp_client.RtmpClient.open(RtmpClient.java:56)
at com.google.android.exoplayer2.ext.rtmp.RtmpDataSource.open(RtmpDataSource.java:60)
at com.google.android.exoplayer2.upstream.StatsDataSource.open(StatsDataSource.java:83)
at com.google.android.exoplayer2.source.ExtractorMediaPeriod$ExtractingLoadable.load(ExtractorMediaPeriod.java:885)
at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:381)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
Upvotes: 6
Views: 1732
Reputation: 23
I had similar problems with it, try modifying this on the RTMP URL:
Before:
Uri uri = Uri.parse("rtmp://172.18.49.6/live/11");
After:
Uri uri = Uri.parse("rtmp://172.18.49.6/live/11 live=1");
Upvotes: 0