Skip to content

Commit

Permalink
Merge pull request #333 from BoleLiu/dev
Browse files Browse the repository at this point in the history
Release v3.1.3
  • Loading branch information
BoleLiu authored May 19, 2022
2 parents ebf0e80 + 2a0b34c commit 91f40e1
Show file tree
Hide file tree
Showing 12 changed files with 54 additions and 27 deletions.
6 changes: 3 additions & 3 deletions PLDroidMediaStreamingDemo/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "com.qiniu.pili.droid.streaming.demo"
minSdkVersion 18
targetSdkVersion 29
versionCode 75
versionName "3.1.2"
versionCode 76
versionName "3.1.3"
}
buildTypes {
release {
Expand All @@ -29,7 +29,7 @@ dependencies {
// 文件选择 jar 包,非必须
implementation 'com.github.angads25:filepicker:1.0.6'
// dns 相关 jar 包,必须依赖
implementation 'com.qiniu:happy-dns:0.2.18'
implementation 'com.qiniu:happy-dns:1.0.0'
// 监听应用生命周期,必须依赖
implementation 'android.arch.lifecycle:extensions:1.1.1'
// 扫码相关 jar 包,非必须
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ private void initEncodingProfile() {
}

// 其他配置项
mProfile.setDnsManager(Util.getMyDnsManager(this))
mProfile.setDnsManager(Util.getMyDnsManager())
.setStreamStatusConfig(new StreamingProfile.StreamStatusConfig(3))
.setSendingBufferProfile(new StreamingProfile.SendingBufferProfile(0.2f, 0.8f, 3.0f, 20 * 1000));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ private void initEncodingProfile() {
}

// 其他配置项
mProfile.setDnsManager(Util.getMyDnsManager(this))
mProfile.setDnsManager(Util.getMyDnsManager())
.setStreamStatusConfig(new StreamingProfile.StreamStatusConfig(3))
.setSendingBufferProfile(new StreamingProfile.SendingBufferProfile(0.2f, 0.8f, 3.0f, 20 * 1000));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ private void initEncodingProfile() {
}

// 其他配置项
mProfile.setDnsManager(Util.getMyDnsManager(this))
mProfile.setDnsManager(Util.getMyDnsManager())
.setStreamStatusConfig(new StreamingProfile.StreamStatusConfig(3))
.setSendingBufferProfile(new StreamingProfile.SendingBufferProfile(0.2f, 0.8f, 3.0f, 20 * 1000));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import android.app.PendingIntent;
import android.content.Intent;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.hardware.Camera;
import android.os.Build;
Expand Down Expand Up @@ -248,7 +247,7 @@ private void initEncodingProfile() {
}

// 其他配置项
mProfile.setDnsManager(Util.getMyDnsManager(this))
mProfile.setDnsManager(Util.getMyDnsManager())
.setStreamStatusConfig(new StreamingProfile.StreamStatusConfig(3))
.setSendingBufferProfile(new StreamingProfile.SendingBufferProfile(0.2f, 0.8f, 3.0f, 20 * 1000));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
import com.qiniu.android.dns.DnsManager;
import com.qiniu.android.dns.IResolver;
import com.qiniu.android.dns.NetworkInfo;
import com.qiniu.android.dns.http.DnspodFree;
import com.qiniu.android.dns.local.AndroidDnsServer;
import com.qiniu.android.dns.local.Resolver;

import java.io.IOException;
import com.qiniu.android.dns.Record;
import com.qiniu.android.dns.dns.DnsUdpResolver;
import com.qiniu.android.dns.dns.DohResolver;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.InetAddress;
import java.net.URL;
import java.util.Random;
import java.util.concurrent.CountDownLatch;

import static com.qiniu.android.dns.IResolver.DNS_DEFAULT_TIMEOUT;

public class Util {

Expand Down Expand Up @@ -77,19 +77,20 @@ public static String syncRequest(String appServerUrl) {
/**
* 配置自定义 DNS 服务器,非必须
*
* 注意:基于 114 dns 解析的不确定性,使用该解析可能会导致解析的网络 ip 无法做到最大的优化策略,进而出现推流质量不佳的现象。
* 因此如果您希望配置 DNS 服务器的话,建议使用非 114 dns 解析
* - 可通过创建 {@link DnsUdpResolver} 对象配置自定义的 DNS 服务器地址
* - 可通过创建 {@link DohResolver} 对象配置支持 Doh(Dns over http) 协议的 url
* 其中,UDP 的方式解析速度快,但是安全性无法得到保证,HTTPDNS 的方式解析速度慢,但是安全性有保证,您可根据您的
* 使用场景自行选择合适的解析方式
*/
public static DnsManager getMyDnsManager(Context context) {
IResolver r0 = null;
IResolver r1 = new DnspodFree();
IResolver r2 = AndroidDnsServer.defaultResolver(context);
try {
r0 = new Resolver(InetAddress.getByName("119.29.29.29"));
} catch (IOException ex) {
ex.printStackTrace();
}
return new DnsManager(NetworkInfo.normal, new IResolver[]{r0, r1, r2});
public static DnsManager getMyDnsManager() {
IResolver[] resolvers = new IResolver[2];
// 配置自定义 DNS 服务器地址
String[] udpDnsServers = new String[]{"223.5.5.5", "114.114.114.114", "1.1.1.1", "208.67.222.222"};
resolvers[0] = new DnsUdpResolver(udpDnsServers, Record.TYPE_A, DNS_DEFAULT_TIMEOUT);
// 配置 HTTPDNS 地址
String[] httpDnsServers = new String[]{"https://223.6.6.6/dns-query", "https://8.8.8.8/dns-query"};
resolvers[1] = new DohResolver(httpDnsServers, Record.TYPE_A, DNS_DEFAULT_TIMEOUT);
return new DnsManager(NetworkInfo.normal, resolvers);
}

public static String getVersion(Context context) {
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,17 @@ PLDroidCameraStreaming 是一个适用于 Android 的 RTMP 直播推流 SDK,

## 版本升级须知

### v3.1.3

- 从 v3.1.3 版本开始,HappyDNS 库务必升级到 1.0.0 版本

### v3.1.2

- 从 v3.1.2 版本开始,SDK 将不再强制要求获取 READ_PHONE_STATE 和 ACCESS_FINE_LOCATION 的权限

### v3.1.1

- 从 v3.1.1 版本开始,Happy DNS 库建议到 0.2.18 版本
- 从 v3.1.1 版本开始,HappyDNS 库务必升级到 0.2.18 版本

### v3.0.2
- 从 v3.0.2 版本开始,请务必添加 `android.arch.lifecycle:extensions:x.y.z` 的依赖
Expand Down
23 changes: 23 additions & 0 deletions ReleaseNotes/release-notes-3.1.3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# PLDroidMediaStreaming Release Notes for 3.1.3

本次更新:

## 版本

- 发布 pldroid-media-streaming-3.1.3.jar

## 功能

- 支持 userID 变更

## 优化

- 更新 HappyDNS 版本为 1.0.0,支持配置 HTTPDNS 服务

## 注意事项

- **从 v3.1.3 版本开始,HappyDNS 库务必升级到 1.0.0 版本**
- 从 v3.1.2 版本开始,SDK 将不再强制要求获取 READ_PHONE_STATE 和 ACCESS_FINE_LOCATION 的权限
- 从 v3.1.1 版本开始,HappyDNS 库务必到 0.2.18 版本
- **从 v3.0.2 版本开始,请务必添加 `android.arch.lifecycle:extensions:x.y.z` 的依赖**
- 从 v3.0.2 版本开始,`StreamingEnv.init(Context context)` 已被弃用,请更新到 `StreamingEnv.init(Context contex, String userId)` 进行环境的初始化,其中,userId 代表用户的唯一标识符,用于区分不同的用户
Binary file removed releases/pldroid-media-streaming-3.1.2.jar
Binary file not shown.
Binary file added releases/pldroid-media-streaming-3.1.3.jar
Binary file not shown.

0 comments on commit 91f40e1

Please sign in to comment.