rtmp流接收

由于目前android官网所提供控件不支持接收rtmp网络流,所以从网上找了一些第三方控件,许多人说使用Vitamio,https://github.com/yixia/VitamioBundle这是vitamio的下载地址,但是我发现该项目已经好几年没有维护,可以说是一个老旧的项目。为了寻找一个免费的项目,又是各种搜索。最终锁定了GiraffePlayer2https://github.com/tcking/GiraffePlayer2这是github地址。然后本人就起了一个Demo去演示该项目的可用性。为了验证是否可以播放rtmp流,那还的找一个rtmp流,又是一顿找,最终找了这么一个地址:湖南卫视,rtmp://58.200.131.2:1935/livetv/hunantv,本人校对过,可以使用,参考文章:https://www.jianshu.com/p/8f29fc3bf3df

接下来就按照官网的需求去使用该控件,以下为需要集成的代码.

1、在build.gradle中引入该控件

 implementation 'com.github.tcking:giraffeplayer2:0.1.25-lazyLoad'

    //for all decoders
    implementation 'com.github.tcking:ijkplayer-arm64:0.8.8-full' //support arm64
    implementation 'com.github.tcking:ijkplayer-armv5:0.8.8-full' //support armv5
    implementation 'com.github.tcking:ijkplayer-x86:0.8.8-full' //support x86
    implementation 'com.github.tcking:ijkplayer-x86_64:0.8.8-full' //support x86_64

2、在布局文件中引入控件

 <tcking.github.com.giraffeplayer2.VideoView
        android:id="@+id/video_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

3、在页面为控件设置url,然后启动控件

videoView.setVideoPath(trim).getPlayer().start()

4、demo下载地址:
https://download.csdn.net/download/zhizhuodewo6/12287801

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值