You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.1 KiB
Java
49 lines
1.1 KiB
Java
10 months ago
|
package com.xypower.mpapp;
|
||
|
|
||
|
import androidx.appcompat.app.AppCompatActivity;
|
||
|
|
||
|
import android.content.Intent;
|
||
|
import android.os.Bundle;
|
||
|
|
||
|
import io.antmedia.rtmp_client.RTMPMuxer;
|
||
|
|
||
|
public class StreamActivity extends AppCompatActivity {
|
||
|
|
||
|
private RTMPMuxer mRtmpMuxer;
|
||
|
private String mUrl;
|
||
|
|
||
|
@Override
|
||
|
protected void onCreate(Bundle savedInstanceState) {
|
||
|
super.onCreate(savedInstanceState);
|
||
|
setContentView(R.layout.activity_stream);
|
||
|
|
||
|
Intent intent = getIntent();
|
||
|
if (intent != null) {
|
||
|
mUrl = intent.getStringExtra("url");
|
||
|
}
|
||
|
|
||
|
openRtmpMuxer(mUrl);
|
||
|
}
|
||
|
|
||
|
protected void openRtmpMuxer(String url) {
|
||
|
if (mRtmpMuxer != null) {
|
||
|
if (mRtmpMuxer.isConnected()) {
|
||
|
mRtmpMuxer.close();
|
||
|
}
|
||
|
} else {
|
||
|
mRtmpMuxer = new RTMPMuxer();
|
||
|
}
|
||
|
|
||
|
int result = mRtmpMuxer.open(url,0, 0);
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
protected void onDestroy() {
|
||
|
super.onDestroy();
|
||
|
|
||
|
if (mRtmpMuxer != null) {
|
||
|
mRtmpMuxer.close();
|
||
|
mRtmpMuxer = null;
|
||
|
}
|
||
|
}
|
||
|
}
|