|
|
@ -57,7 +57,7 @@ public class MainActivity extends AppCompatActivity implements RtmpHandler.RtmpL
|
|
|
|
|
|
|
|
|
|
|
|
private SharedPreferences sp;
|
|
|
|
private SharedPreferences sp;
|
|
|
|
// private String rtmpUrl = "rtmp://192.168.50.250/live/0";
|
|
|
|
// private String rtmpUrl = "rtmp://192.168.50.250/live/0";
|
|
|
|
private String rtmpUrl = "rtmp://61.169.135.146/live/0";
|
|
|
|
private String rtmpUrl = "rtmp://127.0.0.1/live/0";
|
|
|
|
private String recPath = Environment.getExternalStorageDirectory().getPath() + "/test.mp4";
|
|
|
|
private String recPath = Environment.getExternalStorageDirectory().getPath() + "/test.mp4";
|
|
|
|
|
|
|
|
|
|
|
|
private SrsPublisher mPublisher;
|
|
|
|
private SrsPublisher mPublisher;
|
|
|
@ -154,7 +154,7 @@ public class MainActivity extends AppCompatActivity implements RtmpHandler.RtmpL
|
|
|
|
}
|
|
|
|
}
|
|
|
|
efu.setText(rtmpUrl);
|
|
|
|
efu.setText(rtmpUrl);
|
|
|
|
mCameraView = (SrsCameraView) findViewById(R.id.glsurfaceview_camera);
|
|
|
|
mCameraView = (SrsCameraView) findViewById(R.id.glsurfaceview_camera);
|
|
|
|
final int rotation = intent.getIntExtra("rotation", 0);
|
|
|
|
final int rotation = intent.getIntExtra("rotation", -1);
|
|
|
|
if (rotation != -1) {
|
|
|
|
if (rotation != -1) {
|
|
|
|
//设置图像显示方向
|
|
|
|
//设置图像显示方向
|
|
|
|
mCameraView.setPreviewOrientation(rotation);
|
|
|
|
mCameraView.setPreviewOrientation(rotation);
|
|
|
@ -199,9 +199,11 @@ public class MainActivity extends AppCompatActivity implements RtmpHandler.RtmpL
|
|
|
|
editor.putString("rtmpUrl", rtmpUrl);
|
|
|
|
editor.putString("rtmpUrl", rtmpUrl);
|
|
|
|
editor.apply();
|
|
|
|
editor.apply();
|
|
|
|
efu.setText(rtmpUrl + "rotation= " + rotation + " cameraid=" + cameraId + " auto=" + autoStart);
|
|
|
|
efu.setText(rtmpUrl + "rotation= " + rotation + " cameraid=" + cameraId + " auto=" + autoStart);
|
|
|
|
|
|
|
|
// efu.setText(rtmpUrl + " cameraid=" + cameraId + " auto=" + autoStart);
|
|
|
|
|
|
|
|
efu.setText(rtmpUrl);
|
|
|
|
mPublisher.startPublish(rtmpUrl);
|
|
|
|
mPublisher.startPublish(rtmpUrl);
|
|
|
|
if (btnSwitchEncoder.getText().toString().contentEquals("soft encoder")) {
|
|
|
|
if (btnSwitchEncoder.getText().toString().contentEquals("soft encoder")) {
|
|
|
|
Toast.makeText(getApplicationContext(), "Use hard encoder", Toast.LENGTH_SHORT).show();
|
|
|
|
// Toast.makeText(getApplicationContext(), "Use hard encoder", Toast.LENGTH_SHORT).show();
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
Toast.makeText(getApplicationContext(), "Use soft encoder", Toast.LENGTH_SHORT).show();
|
|
|
|
Toast.makeText(getApplicationContext(), "Use soft encoder", Toast.LENGTH_SHORT).show();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -211,7 +213,7 @@ public class MainActivity extends AppCompatActivity implements RtmpHandler.RtmpL
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, 500);
|
|
|
|
}, 500);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
mPublisher.switchCameraFace(cameraId, rotation);
|
|
|
|
mPublisher.switchCameraFace(cameraId,rotation);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int autoClose = intent.getIntExtra("autoClose", 0);
|
|
|
|
int autoClose = intent.getIntExtra("autoClose", 0);
|
|
|
@ -240,7 +242,7 @@ public class MainActivity extends AppCompatActivity implements RtmpHandler.RtmpL
|
|
|
|
efu.setText(rtmpUrl);
|
|
|
|
efu.setText(rtmpUrl);
|
|
|
|
mPublisher.startPublish(rtmpUrl);
|
|
|
|
mPublisher.startPublish(rtmpUrl);
|
|
|
|
// mPublisher.startCamera();
|
|
|
|
// mPublisher.startCamera();
|
|
|
|
mPublisher.switchCameraFace(cameraId, rotation);
|
|
|
|
mPublisher.switchCameraFace(cameraId,rotation);
|
|
|
|
|
|
|
|
|
|
|
|
if (btnSwitchEncoder.getText().toString().contentEquals("soft encoder")) {
|
|
|
|
if (btnSwitchEncoder.getText().toString().contentEquals("soft encoder")) {
|
|
|
|
Toast.makeText(getApplicationContext(), "Use hard encoder", Toast.LENGTH_SHORT).show();
|
|
|
|
Toast.makeText(getApplicationContext(), "Use hard encoder", Toast.LENGTH_SHORT).show();
|
|
|
@ -279,7 +281,7 @@ public class MainActivity extends AppCompatActivity implements RtmpHandler.RtmpL
|
|
|
|
int size = cameraData.size();
|
|
|
|
int size = cameraData.size();
|
|
|
|
if (size > 0) {
|
|
|
|
if (size > 0) {
|
|
|
|
int i = (++cameraId) % size;
|
|
|
|
int i = (++cameraId) % size;
|
|
|
|
mPublisher.switchCameraFace(cameraId, rotation);
|
|
|
|
mPublisher.switchCameraFace(cameraId,rotation);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|