This commit is contained in:
li 2024-05-14 10:37:26 +08:00
parent cc465f03f8
commit 469a9af166
4 changed files with 21 additions and 4 deletions

View File

@ -30,6 +30,7 @@
android:theme="@style/Theme.AndroidWebRTC" android:theme="@style/Theme.AndroidWebRTC"
tools:overrideLibrary="com.zlm.rtc" tools:overrideLibrary="com.zlm.rtc"
android:usesCleartextTraffic="true" android:usesCleartextTraffic="true"
android:hardwareAccelerated="true"
android:name=".App" android:name=".App"
tools:targetApi="31"> tools:targetApi="31">
<activity <activity

View File

@ -17,8 +17,14 @@ class PlayerDemoActivity:AppCompatActivity() {
Handler().postDelayed({ Handler().postDelayed({
ZLMRTCPlayer.shareInstance().play("live","test") ZLMRTCPlayer.shareInstance().play("live","li")
},1000) },1000)
} }
override fun onDestroy() {
super.onDestroy()
ZLMRTCPlayer.shareInstance().destroy()
}
} }

View File

@ -34,6 +34,10 @@ abstract class ZLMRTCPlayer {
public abstract fun pause() public abstract fun pause()
public abstract fun destroy()
public abstract fun resume() public abstract fun resume()
public abstract fun capture(listener: (bitmap: Bitmap) -> Unit) public abstract fun capture(listener: (bitmap: Bitmap) -> Unit)

View File

@ -39,11 +39,11 @@ class ZLMRTCPlayerImpl : ZLMRTCPlayer(), PeerConnectionClient.PeerConnectionEven
false, false,
1280, 1280,
720, 720,
15,
0, 0,
0, "H264",
"VP8", true,
true, true,
false,
0, 0,
"OPUS", "OPUS",
false, false,
@ -136,6 +136,12 @@ class ZLMRTCPlayerImpl : ZLMRTCPlayer(), PeerConnectionClient.PeerConnectionEven
} }
override fun destroy() {
peerConnectionClient?.close()
}
override fun resume() { override fun resume() {
} }