ExoPlayer 无法播放 Adob​​e 实时流编码器流式传输的音频/视频 (RTMP)

Ali*_*i.M 6 android rtmp live-streaming exoplayer2.x

我正在使用在服务器端Adobe Live Stream Encoder流式传输RTMP实时音频。在我的 android 客户端应用程序中,ExoPlayer使用 RTMP 扩展无法播放它并导致RtmpIOException但我可以使用 VLC 或 MPC 播放它。

我用其他一些RTMP链接测试了我的 android 应用程序,它是好的。

我还在手机中安装的其他视频播放器(MxPlayer、Vlc)中使用了这个 url,它没问题。

这是android中播放视频的代码:

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);
Run Code Online (Sandbox Code Playgroud)

这是例外:

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)
Run Code Online (Sandbox Code Playgroud)

小智 0

我遇到了类似的问题,尝试在 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");
Run Code Online (Sandbox Code Playgroud)