diff --git a/PLDroidCameraStreamingDemo/app/build.gradle b/PLDroidCameraStreamingDemo/app/build.gradle
index e5ea21d..f8860ac 100644
--- a/PLDroidCameraStreamingDemo/app/build.gradle
+++ b/PLDroidCameraStreamingDemo/app/build.gradle
@@ -22,5 +22,5 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
- compile files('libs/pldroid-camera-streaming-1.2.1.jar')
+ compile files('libs/pldroid-camera-streaming-1.2.2.jar')
}
diff --git a/PLDroidCameraStreamingDemo/app/libs/pldroid-camera-streaming-1.2.2.jar b/PLDroidCameraStreamingDemo/app/libs/pldroid-camera-streaming-1.2.2.jar
new file mode 100644
index 0000000..f968f72
Binary files /dev/null and b/PLDroidCameraStreamingDemo/app/libs/pldroid-camera-streaming-1.2.2.jar differ
diff --git a/PLDroidCameraStreamingDemo/app/src/main/java/com/pili/pldroid/streaming/camera/demo/CameraStreamingActivity.java b/PLDroidCameraStreamingDemo/app/src/main/java/com/pili/pldroid/streaming/camera/demo/CameraStreamingActivity.java
index bc54d43..4757297 100644
--- a/PLDroidCameraStreamingDemo/app/src/main/java/com/pili/pldroid/streaming/camera/demo/CameraStreamingActivity.java
+++ b/PLDroidCameraStreamingDemo/app/src/main/java/com/pili/pldroid/streaming/camera/demo/CameraStreamingActivity.java
@@ -84,16 +84,26 @@ public void run() {
mCameraSwitchBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
- new Thread(new Runnable() {
- @Override
- public void run() {
- mCameraStreamingManager.switchCamera();
- }
- }).start();
+// new Thread(new Runnable() {
+// @Override
+// public void run() {
+// mCameraStreamingManager.switchCamera();
+// }
+// }).start();
+ mHandler.removeCallbacks(mSwitcher);
+ mHandler.postDelayed(mSwitcher, 100);
}
});
}
+ private Switcher mSwitcher = new Switcher();
+ private class Switcher implements Runnable {
+ @Override
+ public void run() {
+ mCameraStreamingManager.switchCamera();
+ }
+ }
+
private void setTorchEnabled(final boolean enabled) {
runOnUiThread(new Runnable() {
@Override
diff --git a/PLDroidCameraStreamingDemo/app/src/main/java/com/pili/pldroid/streaming/camera/demo/StreamingBaseActivity.java b/PLDroidCameraStreamingDemo/app/src/main/java/com/pili/pldroid/streaming/camera/demo/StreamingBaseActivity.java
index e916676..17ff78e 100644
--- a/PLDroidCameraStreamingDemo/app/src/main/java/com/pili/pldroid/streaming/camera/demo/StreamingBaseActivity.java
+++ b/PLDroidCameraStreamingDemo/app/src/main/java/com/pili/pldroid/streaming/camera/demo/StreamingBaseActivity.java
@@ -40,17 +40,27 @@ public class StreamingBaseActivity extends Activity implements CameraStreamingMa
public void handleMessage(Message msg) {
switch (msg.what) {
case MSG_UPDATE_SHUTTER_BUTTON_STATE:
- mShutterButtonPressed = !mShutterButtonPressed;
- mShutterButton.setPressed(mShutterButtonPressed);
- if (mShutterButtonPressed) {
- boolean res = mCameraStreamingManager.startStreaming();
- Log.i(TAG, "res:" + res);
- if (!res) {
- mShutterButtonPressed = !mShutterButtonPressed;
- mShutterButton.setPressed(mShutterButtonPressed);
- }
+ if (!mShutterButtonPressed) {
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ // disable the shutter button before startStreaming
+ setShutterButtonEnabled(false);
+ boolean res = mCameraStreamingManager.startStreaming();
+ mShutterButtonPressed = true;
+ Log.i(TAG, "res:" + res);
+ if (!res) {
+ mShutterButtonPressed = false;
+ setShutterButtonEnabled(true);
+ }
+ setShutterButtonPressed(mShutterButtonPressed);
+ }
+ }).start();
} else {
+ // disable the shutter button before stopStreaming
+ setShutterButtonEnabled(false);
mCameraStreamingManager.stopStreaming();
+ setShutterButtonPressed(false);
}
break;
default:
@@ -137,16 +147,23 @@ public void onStateChanged(final int state, Object extra) {
break;
case CameraStreamingManager.STATE.STREAMING:
mStatusMsgContent = getString(R.string.string_state_streaming);
+ setShutterButtonEnabled(true);
break;
case CameraStreamingManager.STATE.SHUTDOWN:
mStatusMsgContent = getString(R.string.string_state_ready);
+ setShutterButtonEnabled(true);
+ setShutterButtonPressed(false);
break;
case CameraStreamingManager.STATE.IOERROR:
mStatusMsgContent = getString(R.string.string_state_ready);
+ setShutterButtonEnabled(true);
break;
case CameraStreamingManager.STATE.NETBLOCKING:
mStatusMsgContent = getString(R.string.string_state_netblocking);
break;
+ case CameraStreamingManager.STATE.CONNECTION_TIMEOUT:
+ mStatusMsgContent = getString(R.string.string_state_con_timeout);
+ break;
case CameraStreamingManager.STATE.UNKNOWN:
mStatusMsgContent = getString(R.string.string_state_ready);
break;
diff --git a/PLDroidCameraStreamingDemo/app/src/main/jniLibs/armeabi-v7a/libpldroid_ffmpegbridge.so b/PLDroidCameraStreamingDemo/app/src/main/jniLibs/armeabi-v7a/libpldroid_ffmpegbridge.so
index e768c7c..131510f 100755
Binary files a/PLDroidCameraStreamingDemo/app/src/main/jniLibs/armeabi-v7a/libpldroid_ffmpegbridge.so and b/PLDroidCameraStreamingDemo/app/src/main/jniLibs/armeabi-v7a/libpldroid_ffmpegbridge.so differ
diff --git a/PLDroidCameraStreamingDemo/app/src/main/res/values/strings.xml b/PLDroidCameraStreamingDemo/app/src/main/res/values/strings.xml
index 4c9e838..61fad14 100644
--- a/PLDroidCameraStreamingDemo/app/src/main/res/values/strings.xml
+++ b/PLDroidCameraStreamingDemo/app/src/main/res/values/strings.xml
@@ -13,6 +13,7 @@
CONNECTING
STREAMING
NETBLOCKING, STOPPING
+ CONNECTION TIMEOUT
AudioStreamingActivity
ON
diff --git a/README.md b/README.md
index 540c5e6..f9d08b4 100644
--- a/README.md
+++ b/README.md
@@ -221,6 +221,7 @@ mCameraStreamingManager.setStreamingStateListener(this);
- STATE.NETBLOCKING
- STATE.CAMERA_SWITCHED
- STATE.TORCH_INFO
+- STATE.CONNECTION_TIMEOUT
>您需要注意的是,`onStateChanged` 回调函数可能被非 UI 线程调用,可参考 [CameraStreamingActivity][3]
@@ -274,6 +275,14 @@ mCameraStreamingManager.setNativeLoggingEnabled(false);
- FFMPEG
### 版本历史
+* 1.2.2 ([Release Notes][10])
+ - 发布 pldroid-camera-streaming-1.2.2.jar
+ - 更新 libpldroid_ffmpegbridge.so
+ - 修复概率性的 crash 问题
+ - 添加 `STATE.CONNECTION_TIMEOUT` 状态
+ - 修复部分机型因连接错误而导致屏幕 Hang 住
+ - 在 UI 层对点击事件加入保护逻辑,避免快速点击导致应用 crash
+
* 1.2.1 ([Release Notes][9])
- 发布 pldroid-camera-streaming-1.2.1.jar
- 更新 libpldroid_ffmpegbridge.so
@@ -336,3 +345,4 @@ mCameraStreamingManager.setNativeLoggingEnabled(false);
[7]: /ReleaseNotes/release-notes-1.1.0.md
[8]: /ReleaseNotes/release-notes-1.2.0.md
[9]: /ReleaseNotes/release-notes-1.2.1.md
+[10]: /ReleaseNotes/release-notes-1.2.2.md
diff --git a/ReleaseNotes/release-notes-1.2.2.md b/ReleaseNotes/release-notes-1.2.2.md
new file mode 100644
index 0000000..8aa4b71
--- /dev/null
+++ b/ReleaseNotes/release-notes-1.2.2.md
@@ -0,0 +1,16 @@
+# PLDroidCameraStreaming Release Notes for 1.2.2
+
+## 简介
+PLDroidCameraStreaming 是为 Android 开发者提供的 RTMP 直播推流 SDK
+
+## 记录
+
+### 推流 SDK
+* 发布 pldroid-camera-streaming-1.2.2.jar
+* 更新 libpldroid_ffmpegbridge.so
+* 修复概率性的 crash 问题
+* 添加 `STATE.CONNECTION_TIMEOUT` 状态:streaming 状态下,若网络断开或连接超时,该状态将会被回调
+* 修复部分机型因连接错误而导致屏幕 Hang 住
+
+### Demo
+* 在 UI 层对点击事件加入保护逻辑,避免快速点击导致应用 crash
diff --git a/releases/armeabi-v7a/libpldroid_ffmpegbridge.so b/releases/armeabi-v7a/libpldroid_ffmpegbridge.so
index e768c7c..131510f 100755
Binary files a/releases/armeabi-v7a/libpldroid_ffmpegbridge.so and b/releases/armeabi-v7a/libpldroid_ffmpegbridge.so differ
diff --git a/releases/pldroid-camera-streaming-1.2.2.jar b/releases/pldroid-camera-streaming-1.2.2.jar
new file mode 100644
index 0000000..f968f72
Binary files /dev/null and b/releases/pldroid-camera-streaming-1.2.2.jar differ