Skip to content

Commit

Permalink
Merge pull request #45 from ksvc/v2.3.2-7573
Browse files Browse the repository at this point in the history
update to v2.3.2-7573
  • Loading branch information
chriszeng87 authored May 15, 2017
2 parents ed22bc7 + 11dbfb6 commit d01b8d3
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 112 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ public class CameraActivity extends Activity implements
private boolean mRecording = false;
private boolean mIsFileRecording = false;
private boolean mIsFlashOpened = false;
private boolean mSwitchOrQuit = false;
private String mUrl;
private String mDebugInfo = "";
private String mBgmPath = "/sdcard/test.mp3";
Expand Down Expand Up @@ -525,12 +524,6 @@ public void onPause() {
mOrientationEventListener.disable();
}
mStreamer.onPause();
if (!mSwitchOrQuit) {
// setOffscreenPreview to enable camera capture in background
mStreamer.setOffscreenPreview(mStreamer.getPreviewWidth(),
mStreamer.getPreviewHeight());
}
mSwitchOrQuit = false;

// disable audio low delay in background
if (mAudioLDCheckBox.isChecked()) {
Expand Down Expand Up @@ -889,7 +882,6 @@ private void onAddClick() {
Intent intent = new Intent(getApplicationContext(), FloatViewActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
KSYGlobalStreamer.setInstance(mStreamer);
mSwitchOrQuit = true;
startActivity(intent);
}

Expand All @@ -907,7 +899,6 @@ public void onClick(DialogInterface arg0, int arg1) {
@Override
public void onClick(DialogInterface arg0, int arg1) {
mChronometer.stop();
mSwitchOrQuit = true;
CameraActivity.this.finish();
}
}).show();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.goods_activity);
mObserverButton = new ButtonObserver();
initSurfaceWindow();
addSurfaceWindow();
mLastRotation = getDisplayRotation();
mFloatBack = (ImageView) findViewById(R.id.float_back);
mFloatBack.setOnClickListener(mObserverButton);

mOrientationEventListener = new OrientationEventListener(this,
SensorManager.SENSOR_DELAY_NORMAL) {
Expand All @@ -83,28 +83,20 @@ public void onOrientationChanged(int orientation) {
if (mOrientationEventListener.canDetectOrientation()) {
mOrientationEventListener.enable();
}

addFloatViewWithPermCheck();
}

@Override
protected void onResume() {
Log.d(TAG, "onResume");
super.onResume();
//KSYGlobalStreamer.getInstance().onResume();
//6.0 需要检查overlay权限
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (!Settings.canDrawOverlays(this)) {
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
Uri.parse("package:" + getPackageName()));
startActivityForResult(intent, OVERLAY_PERMISSION_RESULT_CODE);
}
}
}

@Override
protected void onPause() {
Log.d(TAG, "onPause");
super.onPause();
//KSYGlobalStreamer.getInstance().onPause();
}

@Override
Expand Down Expand Up @@ -132,6 +124,7 @@ public boolean onKeyDown(int keyCode, KeyEvent event) {

private void onBackoffClick() {
KSYGlobalStreamer.getInstance().onPause();
KSYGlobalStreamer.getInstance().setDisplayPreview((GLSurfaceView) null);
FloatViewActivity.this.finish();
}

Expand Down Expand Up @@ -202,9 +195,6 @@ public void onClick(View v) {
}
});

mFloatBack = (ImageView) findViewById(R.id.float_back);
mFloatBack.setOnClickListener(mObserverButton);

mCameraView = new GLSurfaceView(this);
KSYGlobalStreamer.getInstance().setDisplayPreview(mCameraView);
RelativeLayout.LayoutParams previewLayoutParams =
Expand Down Expand Up @@ -277,6 +267,18 @@ private int getDisplayRotation() {
return 0;
}

private void addFloatViewWithPermCheck() {
// 6.0 需要检查overlay权限
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !Settings.canDrawOverlays(this)) {
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
Uri.parse("package:" + getPackageName()));
startActivityForResult(intent, OVERLAY_PERMISSION_RESULT_CODE);
} else {
initSurfaceWindow();
addSurfaceWindow();
}
}

/**
* 申请overlay权限窗口返回
*
Expand All @@ -292,6 +294,9 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// SYSTEM_ALERT_WINDOW permission not granted...
Toast.makeText(FloatViewActivity.this, "SYSTEM_ALERT_WINDOW not granted",
Toast.LENGTH_SHORT).show();
} else {
initSurfaceWindow();
addSurfaceWindow();
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion KSYLiveDemo/app/src/main/res/layout/camera_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/recorder_bg_new" >
android:background="#ff000000" >

<android.opengl.GLSurfaceView
android:id="@+id/camera_preview"
Expand Down
87 changes: 0 additions & 87 deletions KSYLiveDemo/build_streamer.sh

This file was deleted.

Binary file modified KSYLiveDemo/libksylive/libs/arm64-v8a/libksylive.so
Binary file not shown.
Binary file modified KSYLiveDemo/libksylive/libs/armeabi-v7a/libksylive.so
Binary file not shown.
Binary file modified KSYLiveDemo/libksylive/libs/armeabi/libksylive.so
Binary file not shown.
Binary file modified KSYLiveDemo/libksylive/libs/ksylive.jar
Binary file not shown.
Binary file modified KSYLiveDemo/libksylive/libs/libksyplayer.jar
Binary file not shown.
Binary file modified KSYLiveDemo/libksylive/libs/x86/libksylive.so
Binary file not shown.

0 comments on commit d01b8d3

Please sign in to comment.