Giter Site home page Giter Site logo

zhongyang2015 / pldroidmediastreaming Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pili-engineering/pldroidmediastreaming

0.0 1.0 0.0 41.45 MB

PLDroidMediaStreaming 是七牛推出的一款适用于 Android 平台的推流 SDK,支持 RTMP 推流,h.264 和 AAC 编码,硬编、软编支持。具有丰富的数据和状态回调,方便用户根据自己的业务定制化开发。具有直播场景下的重要功能,如:美颜、背景音乐、水印等功能。PLDroidMediaStreaming 是现在目前重点维护的版本,自带采集模块也支持用户自己做采集端。

Home Page: https://github.com/pili-engineering/PLDroidMediaStreaming/wiki

License: Apache License 2.0

Java 96.08% GLSL 3.92%

pldroidmediastreaming's Introduction

PLDroidCameraStreaming

PLDroidCameraStreaming 是一个适用于 Android 的 RTMP 直播推流 SDK,可高度定制化和二次开发。特色是同时支持 H.264 软编/硬编和 AAC 软编/硬编。支持 Android Camera 画面捕获,并进行 H.264 编码,以及支持 Android 麦克风音频采样并进行 AAC 编码;还实现了一套可供开发者选择的编码参数集合,以便灵活调节相应的分辨率和码率;同时,SDK 提供数据源回调接口,用户可进行 Filter 处理。借助 PLDroidCameraStreaming ,开发者可以快速构建一款类似 MeerkatPeriscope 的 Android 直播应用。

功能特性

  • 支持 H.264 和 AAC 软编(推荐)
  • 支持 H.264 和 AAC 硬编
  • 软编支持 Android Min API 15(Android 4.0.3)及其以上版本
  • 硬编支持 Android Min API 18(Android 4.3)及其以上版本
  • 支持构造带安全授权凭证的 RTMP 推流地址
  • 支持 RTMP 封包及推流
  • 支持 RTMP 推流自适应网络质量动态切换码率或自定义策略
  • 支持内置美颜,以及可动态调节美颜效果
  • 支持数据源回调接口,可自定义 Filter (滤镜) 特效处理
  • 支持前后置摄像头,以及动态切换
  • 支持自动对焦
  • 支持手动对焦
  • 支持 Encoding Mirror 设置
  • 支持 Zoom 操作
  • 支持 Mute/Unmute
  • 支持闪光灯操作
  • 支持纯音频推流,以及后台运行
  • 支持截帧功能
  • 支持动态更改 Encoding Orientation
  • 支持动态切换横竖屏
  • 支持动态水印
  • 支持动态文字与贴图
  • 支持蓝牙麦克风
  • 支持后台推流
  • 支持双声道立体声
  • 支持 QUIC 推流
  • 支持 ARM, ARMv7a, ARM64v8a, X86 主流芯片体系架构
  • 支持 SEI 信息发送

PLDroidCameraStreaming 文档

详细的开发指南请参考官方文档

设备以及系统要求

  • 设备要求:搭载 Android 系统的设备
  • 系统要求:Android 4.0.3(API 15) 及其以上

版本升级须知

v3.0.0

  • 从 v3.0.0 版本开始,七牛直播推流 SDK 需要先获取授权才能使用。授权分为试用版和正式版,可通过 400-808-9176 转 1 号线联系七牛商务咨询,或者 通过工单 联系七牛的技术支持。
  • v3.0.0 之前的版本不受影响,请继续放心使用。
  • 老客户升级 v3.0.0 版本之前,请先联系七牛获取相应授权,以免发生鉴权不通过的现象。
  • 基于 114 dns 解析的不确定性,使用该解析可能会导致解析的网络 ip 无法做到最大的优化策略,进而出现推流质量不佳的现象。因此建议使用非 114 dns 解析

v2.4.1

  • 从 v2.4.1 开始,VideoProfile 对 H264 格式配置的参数由 annexb 改为 avcc,之前设置为 false 的客户,需要将配置改为 true。

例如目前设有如下配置的客户:

StreamingProfile.VideoProfile vProfile =
	new StreamingProfile.VideoProfile(20, 1000 * 1024, 60, false);

需将参数调整为:

StreamingProfile.VideoProfile vProfile =
	new StreamingProfile.VideoProfile(20, 1000 * 1024, 60, true);

v2.3.0

  • 从 v2.3.0 版本开始,增加 libpldroid_streaming_puic.so 库
  • libpldroid_streaming_core.so 依赖于 libpldroid_streaming_puic.so,无论是否启用 QUIC 推流,都需要包含 libpldroid_streaming_puic.so 库

v2.2.0

  • 从 v2.2.0 版本开始,须要在 build.gradle 中删除 QoS 依赖
dependencies {
    ...
    compile 'com.qiniu.pili:pili-android-qos:0.8.+'
    ...
}

v2.1.0

  • 使用录屏功能前,须要在 AndroidManifest.xml 中注册 SDK 内置的 Activity:
<activity
        android:name="com.qiniu.pili.droid.streaming.screen.ScreenCaptureRequestActivity"
        android:theme="@android:style/Theme.Translucent.NoTitleBar" >
</activity>
  • pili-android-qos 最新版本为 0.8.13

  • 更新 StreamingPreviewCallback#onPreviewFrame

StreamingPreviewCallback#onPreviewFrame(byte[] data, int width, int height)

调整为

/**
* Called if the {@link StreamingPreviewCallback} registered.
*
* @param data the contents of the preview frame in fmt format
* @param width the width of the frame
* @param height the height of the frame
* @param rotation set the clockwise rotation of frame in degrees to achieve the same effect of preview display.
* @param fmt the format of the frame. See also {@link com.qiniu.pili.droid.streaming.av.common.PLFourCC}
* @param tsInNanoTime the timestamp of the frame
*
* */
boolean StreamingPreviewCallback#onPreviewFrame(byte[] data, int width, int height, int rotation, int fmt, long tsInNanoTime);

v2.0.1

从 v2.0.1 开始:

  • 删掉废弃的 CameraStreamingManager,可使用 MediaStreamingManager
  • 须在宿主项目中的 build.gradle 中加入如下语句:
dependencies {
    ...
    compile 'com.qiniu:happy-dns:0.2.+'
    compile 'com.qiniu.pili:pili-android-qos:0.8.+'
    ...
}
  • 废弃的 StreamingPreviewCallback#onPreviewFrame(byte[] bytes, Camera camera) 被删掉,可使用 StreamingPreviewCallback#onPreviewFrame(byte[] bytes, int width, int height)

  • AudioSourceCallback#onAudioSourceAvailable(ByteBuffer byteBuffer, int size, boolean eof) 接口回调中增加时间戳信息,更改为 AudioSourceCallback#onAudioSourceAvailable(ByteBuffer byteBuffer, int size, long tsInNanoTime, boolean eof)

v2.0.0 Beta

v2.0.0 Beta 开始,SDK 由 PLDroidCameraStreaming 更名为 PLDroidMediaStreaming,将会提供更丰富的功能接口。有如下重大更新:

  • 新增 MediaStreamingManager,废弃 CameraStreamingManager 且不再被维护
  • 新增一些辅助类并废弃相关的类
    • 新增 StreamingStateChangedListener,并废弃 CameraStreamingManager#StreamingStateListener
    • 新增 StreamingState,并废弃 CameraStreamingManager#STATE
    • 新增 StreamingSessionListener,并废弃 CameraStreamingManager#StreamingSessionListener
    • 新增 AVCodecType,并废弃 CameraStreamingManager#EncodingType
  • 包名更新为 com.qiniu.pili.droid.streaming.*;,因此需要更新混淆相关代码

v1.6.1

v1.6.1 开始,为了便于用户更好地定制化,将 TransformMatrix 信息加入到 SurfaceTextureCallback#onDrawFrame。因此更新到 v1.6.1 版本之后,若实现了 SurfaceTextureCallback 接口,需要将

int onDrawFrame(int texId, int texWidth, int texHeight);

更改为:

int onDrawFrame(int texId, int texWidth, int texHeight, float[] transformMatrix);

v1.6.0

v1.6.0 开始,在使用 SDK 之前,需要保证 StreamingEnv 被正确初始化 ,否则在构造核心类 CameraStreamingManager 的阶段会抛出异常。具体可参看 Demo

StreamingEnv.init(getApplicationContext());

v1.4.6

从 v1.4.6 版本开始,需要在宿主项目中的 build.gradle 中加入如下语句:

dependencies {
    ...
    compile 'com.qiniu:happy-dns:0.2.7'
    ...
}

否则,在运行时会发生找不到 happydns 相关类的错误。

v1.6.0

v1.6.0 开始,在使用 SDK 之前,需要保证 StreamingEnv 被正确初始化 ,否则在构造核心类 CameraStreamingManager 的阶段会抛出异常。具体可参看 Demo

StreamingEnv.init(getApplicationContext());

v1.6.1

v1.6.1 开始,为了便于用户更好地定制化,将 TransformMatrix 信息加入到 SurfaceTextureCallback#onDrawFrame。因此更新到 v1.6.1 版本之后,若实现了 SurfaceTextureCallback 接口,需要将

int onDrawFrame(int texId, int texWidth, int texHeight);

更改为:

int onDrawFrame(int texId, int texWidth, int texHeight, float[] transformMatrix);

反馈及意见

当你遇到任何问题时,可以通过在 GitHub 的 repo 提交 issues 来反馈问题,请尽可能的描述清楚遇到的问题,如果有错误信息也一同附带,并且在 Labels 中指明类型为 bug 或者其他。

通过这里查看已有的 issues 和提交 Bug。

pldroidmediastreaming's People

Contributors

jpxiong avatar jhuster avatar longbai avatar tanhx2008 avatar why404 avatar boleliu avatar geeklok avatar kevinhuo avatar lawder avatar herashowfeng avatar york1996 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.