yangchaojiang / yjPlay

一个支持自定义UI布局,流式API, 加密,直播 ,亮度,音量,快进等手势 ,广告视频预览,多种加载模式 ,多种分辨率切换 ,多种封面图, 自定义数据源,列表播放,倍数播放,边播变缓存<font color="red">不是使用AndroidVideoCache</font>,离线播放,神奇的播放器
Apache License 2.0
1.73k stars 300 forks source link

请问rtsp支持么 #27

Closed bifan-wei closed 6 years ago

yangchaojiang commented 6 years ago

支持。谢谢支持

yangchaojiang commented 6 years ago

需要你先自定义 实现 rtmp 协议就行 demo 有实例@ @bifan-wei

bifan-wei commented 6 years ago

好的,我试一试,谢谢@yangchaojiang

bifan-wei commented 6 years ago

好像播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();

也是这样的情况。

yangchaojiang commented 6 years ago

你的admin :是什么东东。你的链接也不标准 你后面:554

yangchaojiang commented 6 years ago

我的这个链接 rtsp://184.72.239.149/vod/mp4://BigBuckBunny_175k.mov 就可以播放

bifan-wei commented 6 years ago

我那个是播放摄像头视频流,直连摄像头,是不行的么