Skip to content

Commit

Permalink
Merge pull request #324 from BoleLiu/release
Browse files Browse the repository at this point in the history
Release v3.0.2
  • Loading branch information
BoleLiu authored Feb 5, 2021
2 parents ff43943 + 0fcc393 commit 7d50a61
Show file tree
Hide file tree
Showing 22 changed files with 133 additions and 16 deletions.
18 changes: 10 additions & 8 deletions PLDroidMediaStreamingDemo/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ apply plugin: 'com.android.application'

android {
compileSdkVersion 29
buildToolsVersion '28.0.3'
buildToolsVersion '29.0.3'

defaultConfig {
applicationId "com.qiniu.pili.droid.streaming.demo"
minSdkVersion 16
minSdkVersion 18
targetSdkVersion 29
versionCode 71
versionName "3.0.1"
versionCode 72
versionName "3.0.2"
}
buildTypes {
release {
Expand All @@ -22,17 +22,19 @@ android {
dependencies {
// 文件选择 jar 包,非必须
implementation 'com.github.angads25:filepicker:1.0.6'
// dns 相关 jar 包,若无需自定义 DNS 配置,则无需依赖
implementation 'com.qiniu:happy-dns:0.2.16'
// dns 相关 jar 包,必须依赖
implementation 'com.qiniu:happy-dns:0.2.17'
// 监听应用生命周期,必须依赖
implementation 'android.arch.lifecycle:extensions:1.1.1'
// 扫码相关 jar 包,非必须
implementation 'com.journeyapps:zxing-android-embedded:3.0.2@aar'
implementation 'com.google.zxing:core:3.2.0'
implementation 'com.google.zxing:core:3.3.3'
implementation 'com.android.support:appcompat-v7:28.0.0'

if (buildWithCameraStreamingLibrary) {
implementation project(':library')
} else {
// 推流 SDK jar 包,为推流 SDK 必须依赖的库
implementation files('libs/pldroid-media-streaming-3.0.1.jar')
implementation files('libs/pldroid-media-streaming-3.0.2.jar')
}
}
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion PLDroidMediaStreamingDemo/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />

<uses-feature android:name="android.hardware.camera.autofocus" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.qiniu.pili.droid.streaming.StreamingEnv;
import com.qiniu.pili.droid.streaming.demo.service.KeepAppAliveService;
import com.qiniu.pili.droid.streaming.demo.utils.AppStateTracker;
import com.qiniu.pili.droid.streaming.demo.utils.Util;

public class StreamingApplication extends Application {

Expand All @@ -17,8 +18,10 @@ public void onCreate() {
super.onCreate();
/**
* init must be called before any other func
*
* 注意:参数 userId 代表用户的唯一标识符,用于区分不同的用户
*/
StreamingEnv.init(getApplicationContext());
StreamingEnv.init(getApplicationContext(), Util.getUserId(getApplicationContext()));

/**
* track app background state to avoid possibly stopping microphone recording
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,15 @@ private void initStreamingManager() {
if (mCameraConfig.mIsCustomFaceBeauty) {
mMediaStreamingManager.setSurfaceTextureCallback(mSurfaceTextureCallback);
}
mMediaStreamingManager.setCameraErrorCallback(new Camera.ErrorCallback() {
@Override
public void onError(int errorCode, Camera camera) {
// 摄像头被其他应用抢占时触发
if (errorCode == Camera.CAMERA_ERROR_EVICTED) {
Log.e(TAG, "camera was evicted by the other app!");
}
}
});

mAudioMixer = mMediaStreamingManager.getAudioMixer();
mAudioMixer.setOnAudioMixListener(new OnAudioMixListener() {
Expand Down Expand Up @@ -885,6 +894,25 @@ public void run() {
}
});
break;
case START_VIDEO_ENCODER_FAIL:
case VIDEO_ENCODER_ERROR:
case START_AUDIO_ENCODER_FAIL:
case AUDIO_ENCODER_ERROR:
/**
* 当回调 START_VIDEO_ENCODER_FAIL、VIDEO_ENCODER_ERROR、START_AUDIO_ENCODER_FAIL、
* AUDIO_ENCODER_ERROR 等状态时,代表编码器出现异常,推流已停止,相应资源也已释放,
* 如果需要,可以基于报错的编码器进行重新配置,更新 {@link AVCodecType} 之后,重新开启推流
*/
mIsStreaming = false;
mStatusMsgContent = getString(R.string.string_state_ready);
runOnUiThread(new Runnable() {
@Override
public void run() {
mControlFragment.setShutterButtonPressed(false);
Toast.makeText(AVStreamingActivity.this, "编码器错误!!!", Toast.LENGTH_SHORT).show();
}
});
break;
case IOERROR:
/**
* 在 `startStreaming` 时,如果网络不可用,则会回调此状态
Expand Down Expand Up @@ -972,7 +1000,7 @@ public boolean onRecordAudioFailedHandled(int code) {
public boolean onRestartStreamingHandled(int code) {
Log.i(TAG, "onRestartStreamingHandled");
startStreamingInternal(2000);
return false;
return true;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.util.Log;
import android.view.SurfaceView;
import android.view.View;
Expand Down Expand Up @@ -392,6 +391,24 @@ public void onStateChanged(StreamingState streamingState, Object extra) {
case UNAUTHORIZED_PACKAGE:
mLogContent += "Unauthorized package\n";
break;
case START_VIDEO_ENCODER_FAIL:
case VIDEO_ENCODER_ERROR:
case START_AUDIO_ENCODER_FAIL:
case AUDIO_ENCODER_ERROR:
/**
* 当回调 START_VIDEO_ENCODER_FAIL、VIDEO_ENCODER_ERROR、START_AUDIO_ENCODER_FAIL、
* AUDIO_ENCODER_ERROR 等状态时,代表编码器出现异常,推流已停止,相应资源也已释放,
* 如果需要,可以基于报错的编码器进行重新配置,更新 {@link AVCodecType} 之后,重新开启推流
*/
mStatusMsgContent = getString(R.string.string_state_ready);
setShutterButtonEnabled(true);
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(ImportStreamingActivity.this, "编码器错误!!!", Toast.LENGTH_SHORT).show();
}
});
break;
}
runOnUiThread(new Runnable() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,7 @@ public class Config {
public static final String PUBLISH_URL = "PUBLISH_URL";
public static final String TRANSFER_MODE_QUIC = "TRANSFER_MODE_QUIC";
public static final String AUDIO_CHANNEL_STEREO = "AUDIO_CHANNEL_STEREO";

public static final String SP_NAME = "PLDroidMediaStreamingDemo";
public static final String KEY_USER_ID = "userId";
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,14 @@ public boolean checkPermission() {
if (!addPermission(permissionsList, Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
permissionsNeeded.add("Write external storage");
}
if (!addPermission(permissionsList, Manifest.permission.READ_PHONE_STATE)) {
permissionsNeeded.add("Read phone state");
}
if (!addPermission(permissionsList, Manifest.permission.ACCESS_FINE_LOCATION)) {
permissionsNeeded.add("Access fine location");
}

if (permissionsNeeded.size() > 0) {
if (!permissionsNeeded.isEmpty()) {
// Need Rationale
String message = "You need to grant access to " + permissionsNeeded.get(0);
for (int i = 1; i < permissionsNeeded.size(); i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import android.widget.Toast;

Expand All @@ -17,6 +18,7 @@
import java.net.HttpURLConnection;
import java.net.InetAddress;
import java.net.URL;
import java.util.Random;

public class Util {

Expand Down Expand Up @@ -87,4 +89,21 @@ public static DnsManager getMyDnsManager(Context context) {
}
return new DnsManager(NetworkInfo.normal, new IResolver[]{r0, r1, r2});
}

public static String getUserId(Context context) {
SharedPreferences preferences = context.getSharedPreferences(Config.SP_NAME, Context.MODE_PRIVATE);
String userId = preferences.getString(Config.KEY_USER_ID, "");
if ("".equals(userId)) {
userId = userId();
SharedPreferences.Editor editor = preferences.edit();
editor.putString(Config.KEY_USER_ID, userId);
editor.apply();
}
return userId;
}

private static String userId() {
Random r = new Random();
return System.currentTimeMillis() + "" + r.nextInt(999);
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,19 @@ PLDroidCameraStreaming 是一个适用于 Android 的 RTMP 直播推流 SDK,
## 设备以及系统要求

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

## 版本升级须知

### v3.0.2
- 从 v3.0.2 版本开始,请务必添加 `android.arch.lifecycle:extensions:x.y.z` 的依赖
- 从 v3.0.2 版本开始,`StreamingEnv.init(Context context)` 已被弃用,请更新到 `StreamingEnv.init(Context contex, String userId)` 进行环境的初始化,其中,userId 代表用户的唯一标识符,用于区分不同的用户

### v3.0.1
-3.0.1 版本开始,如果您使用了 Happy DNS 库,建议升级到 0.2.16 版本
-v3.0.1 版本开始,如果您使用了 Happy DNS 库,请务必升级到 0.2.17 版本

### v3.0.0
- **从 v3.0.0 版本开始,七牛直播推流 SDK 需要先获取授权才能使用。授权分为试用版和正式版,可通过 400-808-9176 转 1 号线联系七牛商务咨询,或者 [通过工单](https://support.qiniu.com/?ref=developer.qiniu.com) 联系七牛的技术支持。**
- **从 v3.0.0 版本开始,七牛直播推流 SDK 需要先获取授权才能使用。授权分为试用版和正式版,可通过 400-808-9176 转 2 号线联系七牛商务咨询,或者 [通过工单](https://support.qiniu.com/?ref=developer.qiniu.com) 联系七牛的技术支持。**
- **v3.0.0 之前的版本不受影响,请继续放心使用。**
- **老客户升级 v3.0.0 版本之前,请先联系七牛获取相应授权,以免发生鉴权不通过的现象。**
- 基于 114 dns 解析的不确定性,使用该解析可能会导致解析的网络 ip 无法做到最大的优化策略,进而出现推流质量不佳的现象。因此建议使用非 114 dns 解析
Expand Down
35 changes: 35 additions & 0 deletions ReleaseNotes/release-notes-3.0.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# PLDroidMediaStreaming Release Notes for 3.0.2

本次更新:

## 版本

- 发布 pldroid-media-streaming-3.0.2.jar
- 更新 libpldroid_streaming_core.so

## 功能

- 新增摄像头抢占回调
- 新增编码器异常状态回调

## 优化

- 优化录屏场景下可能出现的帧率较低的问题

## 缺陷

- 修复音视频和纯音频模式动态切换失败的问题
- 修复个别机型推流画面变形的问题
- 修复添加贴纸预览和播放效果不一致的问题
- 修复软编场景实时刷新水印存在的闪烁问题
- 修复特殊场景下偶现的 ANR 问题
- 修复特殊场景下的崩溃问题

## 注意事项

- **从 v3.0.2 版本开始,请务必添加 `android.arch.lifecycle:extensions:x.y.z` 的依赖**
- 从 v3.0.2 版本开始,`StreamingEnv.init(Context context)` 已被弃用,请更新到 `StreamingEnv.init(Context contex, String userId)` 进行环境的初始化,其中,userId 代表用户的唯一标识符,用于区分不同的用户
- 从 v3.0.1 版本开始,Happy DNS 库请务必升级到 0.2.17 版本
- **从 v3.0.0 版本开始,七牛直播推流 SDK 需要先获取授权才能使用。授权分为试用版和正式版,可通过 400-808-9176 转 2 号线联系七牛商务咨询,或者 [通过工单](https://support.qiniu.com/?ref=developer.qiniu.com) 联系七牛的技术支持。**
- **v3.0.0 之前的版本不受影响,请继续放心使用。**
- **老客户升级 v3.0.0 版本之前,请先联系七牛获取相应授权,以免发生鉴权不通过的现象。**
Binary file modified releases/arm64-v8a/libpldroid_streaming_core.so
Binary file not shown.
Binary file modified releases/armeabi-v7a/libpldroid_streaming_core.so
Binary file not shown.
Binary file modified releases/armeabi/libpldroid_streaming_core.so
Binary file not shown.
Binary file removed releases/pldroid-media-streaming-3.0.1.jar
Binary file not shown.
Binary file added releases/pldroid-media-streaming-3.0.2.jar
Binary file not shown.
Binary file modified releases/x86/libpldroid_streaming_core.so
Binary file not shown.

0 comments on commit 7d50a61

Please sign in to comment.