diff --git a/PLDroidMediaStreamingDemo/app/build.gradle b/PLDroidMediaStreamingDemo/app/build.gradle index cae0210..90f4f29 100644 --- a/PLDroidMediaStreamingDemo/app/build.gradle +++ b/PLDroidMediaStreamingDemo/app/build.gradle @@ -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 { @@ -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 包,非必须 diff --git a/PLDroidMediaStreamingDemo/app/libs/pldroid-media-streaming-3.1.2.jar b/PLDroidMediaStreamingDemo/app/libs/pldroid-media-streaming-3.1.2.jar deleted file mode 100644 index bba6388..0000000 Binary files a/PLDroidMediaStreamingDemo/app/libs/pldroid-media-streaming-3.1.2.jar and /dev/null differ diff --git a/PLDroidMediaStreamingDemo/app/libs/pldroid-media-streaming-3.1.3.jar b/PLDroidMediaStreamingDemo/app/libs/pldroid-media-streaming-3.1.3.jar new file mode 100644 index 0000000..c9122f9 Binary files /dev/null and b/PLDroidMediaStreamingDemo/app/libs/pldroid-media-streaming-3.1.3.jar differ diff --git a/PLDroidMediaStreamingDemo/app/src/main/java/com/qiniu/pili/droid/streaming/demo/activity/AVStreamingActivity.java b/PLDroidMediaStreamingDemo/app/src/main/java/com/qiniu/pili/droid/streaming/demo/activity/AVStreamingActivity.java index 0d2f95d..c9cb379 100644 --- a/PLDroidMediaStreamingDemo/app/src/main/java/com/qiniu/pili/droid/streaming/demo/activity/AVStreamingActivity.java +++ b/PLDroidMediaStreamingDemo/app/src/main/java/com/qiniu/pili/droid/streaming/demo/activity/AVStreamingActivity.java @@ -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)); } diff --git a/PLDroidMediaStreamingDemo/app/src/main/java/com/qiniu/pili/droid/streaming/demo/activity/AudioStreamingActivity.java b/PLDroidMediaStreamingDemo/app/src/main/java/com/qiniu/pili/droid/streaming/demo/activity/AudioStreamingActivity.java index a26a7fe..25a095d 100644 --- a/PLDroidMediaStreamingDemo/app/src/main/java/com/qiniu/pili/droid/streaming/demo/activity/AudioStreamingActivity.java +++ b/PLDroidMediaStreamingDemo/app/src/main/java/com/qiniu/pili/droid/streaming/demo/activity/AudioStreamingActivity.java @@ -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)); } diff --git a/PLDroidMediaStreamingDemo/app/src/main/java/com/qiniu/pili/droid/streaming/demo/activity/ImportStreamingActivity.java b/PLDroidMediaStreamingDemo/app/src/main/java/com/qiniu/pili/droid/streaming/demo/activity/ImportStreamingActivity.java index 8e7bfae..d04b46d 100644 --- a/PLDroidMediaStreamingDemo/app/src/main/java/com/qiniu/pili/droid/streaming/demo/activity/ImportStreamingActivity.java +++ b/PLDroidMediaStreamingDemo/app/src/main/java/com/qiniu/pili/droid/streaming/demo/activity/ImportStreamingActivity.java @@ -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)); } diff --git a/PLDroidMediaStreamingDemo/app/src/main/java/com/qiniu/pili/droid/streaming/demo/activity/ScreenStreamingActivity.java b/PLDroidMediaStreamingDemo/app/src/main/java/com/qiniu/pili/droid/streaming/demo/activity/ScreenStreamingActivity.java index 8720c3f..d0d7490 100644 --- a/PLDroidMediaStreamingDemo/app/src/main/java/com/qiniu/pili/droid/streaming/demo/activity/ScreenStreamingActivity.java +++ b/PLDroidMediaStreamingDemo/app/src/main/java/com/qiniu/pili/droid/streaming/demo/activity/ScreenStreamingActivity.java @@ -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; @@ -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)); } diff --git a/PLDroidMediaStreamingDemo/app/src/main/java/com/qiniu/pili/droid/streaming/demo/utils/Util.java b/PLDroidMediaStreamingDemo/app/src/main/java/com/qiniu/pili/droid/streaming/demo/utils/Util.java index 80ac897..5e689e2 100644 --- a/PLDroidMediaStreamingDemo/app/src/main/java/com/qiniu/pili/droid/streaming/demo/utils/Util.java +++ b/PLDroidMediaStreamingDemo/app/src/main/java/com/qiniu/pili/droid/streaming/demo/utils/Util.java @@ -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 { @@ -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) { diff --git a/README.md b/README.md index 66c2d2b..ae96229 100644 --- a/README.md +++ b/README.md @@ -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` 的依赖 diff --git a/ReleaseNotes/release-notes-3.1.3.md b/ReleaseNotes/release-notes-3.1.3.md new file mode 100644 index 0000000..1fe435e --- /dev/null +++ b/ReleaseNotes/release-notes-3.1.3.md @@ -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 代表用户的唯一标识符,用于区分不同的用户 \ No newline at end of file diff --git a/releases/pldroid-media-streaming-3.1.2.jar b/releases/pldroid-media-streaming-3.1.2.jar deleted file mode 100644 index bba6388..0000000 Binary files a/releases/pldroid-media-streaming-3.1.2.jar and /dev/null differ diff --git a/releases/pldroid-media-streaming-3.1.3.jar b/releases/pldroid-media-streaming-3.1.3.jar new file mode 100644 index 0000000..c9122f9 Binary files /dev/null and b/releases/pldroid-media-streaming-3.1.3.jar differ