From 2c66c18bcce4cedf6cc6e08250d8bd2fbe9dc9c5 Mon Sep 17 00:00:00 2001 From: lzj Date: Wed, 15 Apr 2020 17:57:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DAndroid=E7=AB=AF=E9=80=80?= =?UTF-8?q?=E5=87=BA=E4=B9=8B=E5=90=8E=EF=BC=8C=E5=86=8D=E6=AC=A1=E8=BF=9B?= =?UTF-8?q?=E6=9D=A5=E7=94=BB=E9=9D=A2=E4=B8=8D=E5=8A=A8=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/jimi/rn/rtmp/JMRTMPPlayerManager.java | 15 ++++++--------- example/App.js | 10 ++++++++++ example/package.json | 2 +- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/android/src/main/java/com/jimi/rn/rtmp/JMRTMPPlayerManager.java b/android/src/main/java/com/jimi/rn/rtmp/JMRTMPPlayerManager.java index 488d545..34a680f 100644 --- a/android/src/main/java/com/jimi/rn/rtmp/JMRTMPPlayerManager.java +++ b/android/src/main/java/com/jimi/rn/rtmp/JMRTMPPlayerManager.java @@ -82,23 +82,17 @@ public JMRTMPPlayerManager(ReactApplicationContext reactContext) { private final LifecycleEventListener mLifecycleEventListener = new LifecycleEventListener() { @Override public void onHostResume() { - JMRTMPMonitorManager.isResume = true; - if (glMonitor != null) { - glMonitor.onResume(); - } + JMRTMPMonitorManager.setIsResume(true); } @Override public void onHostPause() { - JMRTMPMonitorManager.isResume = false; - if (glMonitor != null) { - glMonitor.onPause(); - } + JMRTMPMonitorManager.setIsResume(false); } @Override public void onHostDestroy() { - JMRTMPMonitorManager.isResume = false; + JMRTMPMonitorManager.setIsResume(false); if (mContext != null && mBroadcastReceiver != null) { mContext.unregisterReceiver(mBroadcastReceiver); mBroadcastReceiver = null; @@ -138,6 +132,7 @@ public void deInitialize() { public void startPlayLive() { if (gJMVideoStreamPlayer != null) { gJMVideoStreamPlayer.startPlayLive(); + JMRTMPMonitorManager.setIsResume(true); } } @@ -145,6 +140,7 @@ public void startPlayLive() { public void startPlay(String url) { if (gJMVideoStreamPlayer != null) { gJMVideoStreamPlayer.startPlay(url); + JMRTMPMonitorManager.setIsResume(true); } } @@ -159,6 +155,7 @@ public void startPlayback(ReadableArray fileNameArray) { } gJMVideoStreamPlayer.startPlayback(list); + JMRTMPMonitorManager.setIsResume(true); } } diff --git a/example/App.js b/example/App.js index d157a43..2ef0a49 100755 --- a/example/App.js +++ b/example/App.js @@ -103,6 +103,12 @@ export default class App extends Component { { this.clickedSwitchCamera() }}> 切换摄像头 + { this.clickedStopAll() }}> + Stop + + { this.clickedReStart() }}> + ReStart + ); @@ -183,6 +189,10 @@ export default class App extends Component { JMRTMPPlayerManager.setMute(this.state.mute); }); } + + clickedReStart() { + JMRTMPPlayerManager.reStart(); + } } const styles = StyleSheet.create({ diff --git a/example/package.json b/example/package.json index 0d56e71..57f00e5 100644 --- a/example/package.json +++ b/example/package.json @@ -10,7 +10,7 @@ "react": "16.6.3", "react-native": "0.58.6", "react-native-fs": "2.13.3", - "react-native-rtmp-player-jm": "^1.1.6" + "react-native-rtmp-player-jm": "^1.1.8" }, "devDependencies": { "babel-core": "^7.0.0-bridge.0",