Camera2 修改旋转角度

master
liuguijing 7 months ago
parent 4723d82cff
commit 9b6d2accca

@ -144,7 +144,6 @@ public class MainActivity extends AppCompatActivity implements RtmpHandler.RtmpL
btnPause = (Button) findViewById(R.id.pause);
btnPause.setEnabled(false);
Intent intent = getIntent();
String url = intent.getStringExtra("url");
if (!TextUtils.isEmpty(url)) {
rtmpUrl = url;
@ -431,6 +430,48 @@ public class MainActivity extends AppCompatActivity implements RtmpHandler.RtmpL
mPublisher.startCamera();
}
private void startRTMPServer() {
File streamingDir = new File(getDataDir(), "streaming");
if (!streamingDir.exists()) {
streamingDir.mkdirs();
}
File confFile = new File(streamingDir, "zlmediakit.ini");
InputStream inputStream = null;
FileOutputStream fos = null;
try {
inputStream = getAssets().open("config.ini");
fos = new FileOutputStream(confFile);
int len=-1;
byte[] buffer = new byte[1024];
while ((len=inputStream.read(buffer)) != -1) {
fos.write(buffer,0, len);
}
fos.flush();
} catch (Exception e) {
e.printStackTrace();
} finally {
closeFriendly(inputStream);
closeFriendly(fos);
}
ZLMediaKit.startServer(streamingDir.getAbsolutePath());
}
private void stopRTMPServer() {
ZLMediaKit.stopServer();
}
public static void closeFriendly(AutoCloseable closeable) {
if (closeable != null) {
try {
closeable.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
private static String getRandomAlphaString(int length) {
String base = "abcdefghijklmnopqrstuvwxyz";
Random random = new Random();

Loading…
Cancel
Save