ITPub博客

首页 > 应用开发 > IT综合 > Android技术分享| anyLive 开源项目

Android技术分享| anyLive 开源项目

原创 IT综合 作者:anyRTC 时间:2022-03-09 12:03:47 0 删除 编辑

简介

anyLive 是开源的推拉流项目,本项目采用跨平台架构设计,一套代码支持Android、iOS、Windows、Mac、Ubuntu等平台。本文主要介绍 anyLive Android 平台的实现。

此项目中包含对 JNI 的使用,WebRTC Native 的实践,音视频编解码的相关实现。

功能特性

  • 推流

  • 拉流

  • 屏幕共享

  • 图片推流

  • 基于GPUImage的实时滤镜

  • 音视频采集编解码方面基于 WebRTC-93、 ffmpeg4.3

  • 音视频自采集自渲染

  • 等

Demo展示

项目源码

GO🚀

编译注意事项

使用 AndroidStudio 打开之前,需要下载 webRTC,ffmpeg库。

下载地址:👉 Lib

下载解压缩后将lib文件夹移至: liveplayer/src/main/cpp 目录下即可

请使用 NDK 版本:20.0.5594570 编译,否则可能会出现各种错误🙅‍

API调用

ArLiveEngine
创建引擎
//用于创建播放器、推流器

val liveEngine = ArLiveEngine.create(context:Context)
释放引擎
ArLiveEngine.release()
创建推流器
liveEngine.createArLivePusher()
创建播放器
liveEngine.createArLivePlayer()
ArLivePusher
设置推流器回调
void setObserver(ArLivePusherObserver observer)
设置本地摄像头预览 View
int setRenderView(TextureViewRenderer view)
打开摄像头
int startCamera(boolean frontCamera)

开始推流

int startPush(String url)

更多方法请参考 ArLivePusher 类 注释

ArLivePlayer
设置播放器器回调
void setObserver(ArLivePlayerObserver observer)
设置播放器的视频渲染 View
int setRenderView(TextureViewRenderer view)
开始播放
int startPlay(String url)

更多方法请参考 ArLivePusher 类 注释


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/70013909/viewspace-2868450/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2022-02-15

  • 博文量
    125
  • 访问量
    68142