|
|
@ -4,7 +4,6 @@ import android.Manifest;
|
|
|
|
import android.content.Intent;
|
|
|
|
import android.content.Intent;
|
|
|
|
import android.content.pm.ActivityInfo;
|
|
|
|
import android.content.pm.ActivityInfo;
|
|
|
|
import android.content.pm.PackageManager;
|
|
|
|
import android.content.pm.PackageManager;
|
|
|
|
import android.content.res.Configuration;
|
|
|
|
|
|
|
|
import android.hardware.Camera;
|
|
|
|
import android.hardware.Camera;
|
|
|
|
import android.os.Build;
|
|
|
|
import android.os.Build;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.os.Bundle;
|
|
|
@ -211,7 +210,6 @@ public class MainActivity extends AppCompatActivity implements RtmpHandler.RtmpL
|
|
|
|
}
|
|
|
|
}
|
|
|
|
efu.setText(rtmpUrl);
|
|
|
|
efu.setText(rtmpUrl);
|
|
|
|
mPublisher.startPublish(rtmpUrl);
|
|
|
|
mPublisher.startPublish(rtmpUrl);
|
|
|
|
// mPublisher.startCamera();
|
|
|
|
|
|
|
|
mPublisher.switchCameraFace(cameraId, rotation);
|
|
|
|
mPublisher.switchCameraFace(cameraId, rotation);
|
|
|
|
|
|
|
|
|
|
|
|
if (btnSwitchEncoder.getText().toString().contentEquals("soft encoder")) {
|
|
|
|
if (btnSwitchEncoder.getText().toString().contentEquals("soft encoder")) {
|
|
|
@ -294,7 +292,7 @@ public class MainActivity extends AppCompatActivity implements RtmpHandler.RtmpL
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
public void run() {
|
|
|
|
// rtmpUrl = "rtsp://127.0.0.1:8554/live/7";
|
|
|
|
// rtmpUrl = "rtsp://127.0.0.1:8554/live/7";
|
|
|
|
efu.setText(rtmpUrl + "rotation= " + rotation + " cameraid=" + cameraId + " auto=" + autoStart);
|
|
|
|
efu.setText(rtmpUrl + " rotation= " + rotation + " cameraid=" + cameraId + " auto=" + autoStart);
|
|
|
|
if (netCamera == 0) {
|
|
|
|
if (netCamera == 0) {
|
|
|
|
mPublisher.startPublish(rtmpUrl);
|
|
|
|
mPublisher.startPublish(rtmpUrl);
|
|
|
|
if (btnSwitchEncoder.getText().toString().contentEquals("soft encoder")) {
|
|
|
|
if (btnSwitchEncoder.getText().toString().contentEquals("soft encoder")) {
|
|
|
@ -441,24 +439,26 @@ public class MainActivity extends AppCompatActivity implements RtmpHandler.RtmpL
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected void onDestroy() {
|
|
|
|
protected void onDestroy() {
|
|
|
|
super.onDestroy();
|
|
|
|
super.onDestroy();
|
|
|
|
sendStopPushBroadcast();
|
|
|
|
if (netCamera == 1) {
|
|
|
|
|
|
|
|
sendStopPushBroadcast();
|
|
|
|
|
|
|
|
}
|
|
|
|
stopRTMPServer();
|
|
|
|
stopRTMPServer();
|
|
|
|
mPublisher.stopPublish();
|
|
|
|
mPublisher.stopPublish();
|
|
|
|
mPublisher.stopRecord();
|
|
|
|
mPublisher.stopRecord();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
// @Override
|
|
|
|
public void onConfigurationChanged(Configuration newConfig) {
|
|
|
|
// public void onConfigurationChanged(Configuration newConfig) {
|
|
|
|
super.onConfigurationChanged(newConfig);
|
|
|
|
// super.onConfigurationChanged(newConfig);
|
|
|
|
mPublisher.stopEncode();
|
|
|
|
// mPublisher.stopEncode();
|
|
|
|
mPublisher.stopRecord();
|
|
|
|
// mPublisher.stopRecord();
|
|
|
|
btnRecord.setText("record");
|
|
|
|
// btnRecord.setText("record");
|
|
|
|
mPublisher.setScreenOrientation(newConfig.orientation);
|
|
|
|
// mPublisher.setScreenOrientation(newConfig.orientation);
|
|
|
|
if (btnPublish.getText().toString().contentEquals("stop")) {
|
|
|
|
// if (btnPublish.getText().toString().contentEquals("stop")) {
|
|
|
|
mPublisher.startEncode();
|
|
|
|
// mPublisher.startEncode();
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
mPublisher.startCamera();
|
|
|
|
// mPublisher.startCamera();
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
private void startRTMPServer() {
|
|
|
|
private void startRTMPServer() {
|
|
|
|
File streamingDir = null;
|
|
|
|
File streamingDir = null;
|
|
|
|