Closed bifan-wei closed 6 years ago
需要你先自定义 实现 rtmp 协议就行 demo 有实例@ @bifan-wei
好的,我试一试,谢谢@yangchaojiang
好像播rtsp出错了,我用demo,DataSource改成 使用 new RtmpDataSourceFactory(); ,华为手机直接白屏卡着不动,换小米6加载两三秒后闪退出去,这是日志: E/ExoPlayerImplInternal: Source error. net.butterflytv.rtmp_client.RtmpClient$RtmpIOException at net.butterflytv.rtmp_client.RtmpClient.open(RtmpClient.java:55) at com.google.android.exoplayer2.ext.rtmp.RtmpDataSource.open(RtmpDataSource.java:57) at com.google.android.exoplayer2.source.ExtractorMediaPeriod$ExtractingLoadable.load(ExtractorMediaPeriod.java:692) at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:315) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) at java.lang.Thread.run(Thread.java:760) 11-07 10:24:59.789 31581-31581/chuangyuan.xiangjiang.yjplay E/chuangyuan.ycj.videolibrary.video.ExoUserPlayer: onPlayerError:null
我试着自己写demo,代码如下: @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_player); init(); }
private GestureVideoPlayer exoPlayerManager;
private VideoPlayerView videoPlayerView;
private void init() {
//实例化播放控制类
videoPlayerView = (VideoPlayerView) findViewById(R.id.exo_play_context_id);
exoPlayerManager = new GestureVideoPlayer(this, videoPlayerView, new DataSource(this.getApplication()));
}
public void restart(View view) {
exoPlayerManager.setPlayUri("rtsp://admin:lg123456@192.168.2.168:554");
exoPlayerManager.startPlayer();
}
public void start(View view) {
exoPlayerManager.setPlayUri("rtsp://admin:lg123456@192.168.2.168:554");
exoPlayerManager.startPlayer();
}
DataSource改成 使用 new RtmpDataSourceFactory();
也是这样的情况。
你的admin :是什么东东。你的链接也不标准 你后面:554
我的这个链接 rtsp://184.72.239.149/vod/mp4://BigBuckBunny_175k.mov 就可以播放
我那个是播放摄像头视频流,直连摄像头,是不行的么
支持。谢谢支持