diff --git a/android/libs/JimiVideoPlayerSDK.jar b/android/libs/JimiVideoPlayerSDK.jar index 9a44e57..9765b7e 100644 Binary files a/android/libs/JimiVideoPlayerSDK.jar and b/android/libs/JimiVideoPlayerSDK.jar differ diff --git a/android/src/main/java/com/jimi/rn/rtmp/JMRTMPJSConstant.java b/android/src/main/java/com/jimi/rn/rtmp/JMRTMPJSConstant.java new file mode 100644 index 0000000..5be135d --- /dev/null +++ b/android/src/main/java/com/jimi/rn/rtmp/JMRTMPJSConstant.java @@ -0,0 +1,103 @@ +package com.jimi.rn.rtmp; + +import java.util.HashMap; +import java.util.Map; + +import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_RECEIVE_CMD_PLAYBACK_ALL_END; +import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_RECEIVE_CMD_PLAYBACK_FILE_END; +import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_RECORD_STATUS_COMPLETE; +import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_RECORD_STATUS_ERR_AUTHORITY; +import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_RECORD_STATUS_ERR_FAIL; +import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_RECORD_STATUS_ERR_PATH; +import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_RECORD_STATUS_ERR_RECORDING; +import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_RECORD_STATUS_ERR_SAVE; +import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_RECORD_STATUS_START; +import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_TALK_STATUS_ERR_AUTHORITY; +import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_TALK_STATUS_ERR_DEVICE_REPLY_FAIL; +import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_TALK_STATUS_ERR_HTTP_HOST; +import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_TALK_STATUS_ERR_HTTP_PARAMETER; +import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_TALK_STATUS_ERR_HTTP_TIMEOUT; +import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_TALK_STATUS_ERR_INIT; +import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_TALK_STATUS_ERR_NETWORK_ANOMALY; +import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_TALK_STATUS_ERR_SEND; +import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_TALK_STATUS_ERR_SERVER_DATA; +import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_TALK_STATUS_ERR_TALKING; +import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_TALK_STATUS_ERR_URL_GET; +import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_TALK_STATUS_PREPARE; +import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_TALK_STATUS_START; +import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_TALK_STATUS_STOP; +import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_VIDEO_STATUS_ERR_DEVICE_REPLY_FAIL; +import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_VIDEO_STATUS_ERR_HTTP_HOST; +import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_VIDEO_STATUS_ERR_HTTP_PARAMETER; +import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_VIDEO_STATUS_ERR_HTTP_TIMEOUT; +import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_VIDEO_STATUS_ERR_NETWORK_ANOMALY; +import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_VIDEO_STATUS_ERR_OPEN_FAIL; +import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_VIDEO_STATUS_ERR_OPEN_TIMEOUT; +import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_VIDEO_STATUS_ERR_PLAY_ABNORMAL; +import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_VIDEO_STATUS_ERR_SERVER_DATA; +import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_VIDEO_STATUS_ERR_URL_GET; +import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_VIDEO_STATUS_ERR_URL_INVALID; +import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_VIDEO_STATUS_PREPARE; +import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_VIDEO_STATUS_START; +import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_VIDEO_STATUS_STOP; + +public class JMRTMPJSConstant { + public static String kOnStreamPlayerPlayStatus = "kOnStreamPlayerPlayStatus"; + public static String kOnStreamPlayerTalkStatus = "kOnStreamPlayerTalkStatus"; + public static String kOnStreamPlayerRecordStatus = "kOnStreamPlayerRecordStatus"; + public static String kOnStreamPlayerReceiveFrameInfo = "kOnStreamPlayerReceiveFrameInfo"; + public static String kOnStreamPlayerReceiveDeviceData = "kOnStreamPlayerReceiveDeviceData"; + + public static Map constantsToExport() { + Map constants = new HashMap<>(); + constants.put(kOnStreamPlayerPlayStatus, kOnStreamPlayerPlayStatus); + constants.put(kOnStreamPlayerTalkStatus, kOnStreamPlayerTalkStatus); + constants.put(kOnStreamPlayerRecordStatus, kOnStreamPlayerRecordStatus); + constants.put(kOnStreamPlayerReceiveFrameInfo, kOnStreamPlayerReceiveFrameInfo); + constants.put(kOnStreamPlayerReceiveDeviceData, kOnStreamPlayerReceiveDeviceData); + + constants.put("videoStatusPrepare", STREAM_VIDEO_STATUS_PREPARE); + constants.put("videoStatusStart", STREAM_VIDEO_STATUS_START); + constants.put("videoStatusStop", STREAM_VIDEO_STATUS_STOP); + constants.put("videoStatusErrURLGet", STREAM_VIDEO_STATUS_ERR_URL_GET); + constants.put("videoStatusErrURLInvalid", STREAM_VIDEO_STATUS_ERR_URL_INVALID); + constants.put("videoStatusErrOpenFail", STREAM_VIDEO_STATUS_ERR_OPEN_FAIL); + constants.put("videoStatusErrOpenTimeout", STREAM_VIDEO_STATUS_ERR_OPEN_TIMEOUT); + constants.put("videoStatusErrPlayAbnormal", STREAM_VIDEO_STATUS_ERR_PLAY_ABNORMAL); + constants.put("videoStatusErrHttpTimeout", STREAM_VIDEO_STATUS_ERR_HTTP_TIMEOUT); + constants.put("videoStatusErrHttpHost", STREAM_VIDEO_STATUS_ERR_HTTP_HOST); + constants.put("videoStatusErrHttpParameter", STREAM_VIDEO_STATUS_ERR_HTTP_PARAMETER); + constants.put("videoStatusErrServerData", STREAM_VIDEO_STATUS_ERR_SERVER_DATA); + constants.put("videoStatusErrDeviceReplayFail", STREAM_VIDEO_STATUS_ERR_DEVICE_REPLY_FAIL); + constants.put("videoStatusErrNetworkAnomaly", STREAM_VIDEO_STATUS_ERR_NETWORK_ANOMALY); + + constants.put("talkStatusPrepare", STREAM_TALK_STATUS_PREPARE); + constants.put("talkStatusStart", STREAM_TALK_STATUS_START); + constants.put("talkStatusStop", STREAM_TALK_STATUS_STOP); + constants.put("talkStatusErrURLGet", STREAM_TALK_STATUS_ERR_URL_GET); + constants.put("talkStatusErrInit", STREAM_TALK_STATUS_ERR_INIT); + constants.put("talkStatusErrTalking", STREAM_TALK_STATUS_ERR_TALKING); + constants.put("talkStatusErrSend", STREAM_TALK_STATUS_ERR_SEND); + constants.put("talkStatusErrHttpTimeout", STREAM_TALK_STATUS_ERR_HTTP_TIMEOUT); + constants.put("talkStatusErrHttpHost", STREAM_TALK_STATUS_ERR_HTTP_HOST); + constants.put("talkStatusErrHttpParameter", STREAM_TALK_STATUS_ERR_HTTP_PARAMETER); + constants.put("talkStatusErrServerData", STREAM_TALK_STATUS_ERR_SERVER_DATA); + constants.put("talkStatusErrDeviceReplayFail", STREAM_TALK_STATUS_ERR_DEVICE_REPLY_FAIL); + constants.put("talkStatusErrNetworkAnomaly", STREAM_TALK_STATUS_ERR_NETWORK_ANOMALY); + constants.put("talkStatusErrAuthority", STREAM_TALK_STATUS_ERR_AUTHORITY); + + constants.put("recordStatusStart", STREAM_RECORD_STATUS_START); + constants.put("recordStatusComplete", STREAM_RECORD_STATUS_COMPLETE); + constants.put("recordStatusErrRecording", STREAM_RECORD_STATUS_ERR_RECORDING); + constants.put("recordStatusErrFail", STREAM_RECORD_STATUS_ERR_FAIL); + constants.put("recordStatusErrSave", STREAM_RECORD_STATUS_ERR_SAVE); + constants.put("recordStatusErrPath", STREAM_RECORD_STATUS_ERR_PATH); + constants.put("recordStatusErrAuthority", STREAM_RECORD_STATUS_ERR_AUTHORITY); + + constants.put("receiveCmdPlaybackOneEnd", STREAM_RECEIVE_CMD_PLAYBACK_FILE_END); + constants.put("receiveCmdPlaybackAllEnd", STREAM_RECEIVE_CMD_PLAYBACK_ALL_END); + + return constants; + } + +} diff --git a/android/src/main/java/com/jimi/rn/rtmp/JMRTMPMonitorManager.java b/android/src/main/java/com/jimi/rn/rtmp/JMRTMPMonitorManager.java index aaa9515..ad47016 100644 --- a/android/src/main/java/com/jimi/rn/rtmp/JMRTMPMonitorManager.java +++ b/android/src/main/java/com/jimi/rn/rtmp/JMRTMPMonitorManager.java @@ -30,7 +30,7 @@ import com.jimi.jimivideoplayer.opengl.GLMonitor; public class JMRTMPMonitorManager extends SimpleViewManager { - public static GLMonitor glMonitor; + private static GLMonitor glMonitor; public static boolean isResume = false; private DataSource> dataSource; private DraweeHolder imageHolder; @@ -40,6 +40,14 @@ public String getName() { return "JMRTMPMonitor"; } + public static GLMonitor getGLMonitor(){ + return glMonitor; + } + + public static void removeGLMonitor() { + glMonitor = null; + } + @Override protected GLMonitor createViewInstance(ThemedReactContext reactContext) { if (glMonitor == null) { 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 1a06ecc..851f1ad 100644 --- a/android/src/main/java/com/jimi/rn/rtmp/JMRTMPPlayerManager.java +++ b/android/src/main/java/com/jimi/rn/rtmp/JMRTMPPlayerManager.java @@ -1,6 +1,5 @@ package com.jimi.rn.rtmp; -import android.app.Activity; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; @@ -8,8 +7,7 @@ import android.graphics.Bitmap; import android.text.TextUtils; -import com.facebook.react.bridge.ActivityEventListener; -import com.facebook.react.bridge.BaseActivityEventListener; +import com.facebook.react.bridge.Arguments; import com.facebook.react.bridge.LifecycleEventListener; import com.facebook.react.bridge.Promise; import com.facebook.react.bridge.ReactApplicationContext; @@ -17,15 +15,15 @@ import com.facebook.react.bridge.ReactMethod; import com.facebook.react.bridge.ReadableArray; import com.facebook.react.bridge.ReadableMap; +import com.facebook.react.bridge.WritableMap; +import com.facebook.react.modules.core.DeviceEventManagerModule; import com.jimi.jimivideoplayer.JMHttpRequestTaskListener; import com.jimi.jimivideoplayer.JMSwitchCameraListener; import com.jimi.jimivideoplayer.JMVideoStreamPlayer; import com.jimi.jimivideoplayer.JMVideoStreamPlayerListener; import com.jimi.jimivideoplayer.bean.FrameInfo; import com.jimi.jimivideoplayer.log.JMLogUtil; - -import org.json.JSONException; -import org.json.JSONObject; +import com.jimi.jimivideoplayer.opengl.GLMonitor; import java.io.File; import java.io.FileOutputStream; @@ -37,54 +35,17 @@ import javax.annotation.Nullable; -import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_RECEIVE_CMD_PLAYBACK_ALL_END; -import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_RECEIVE_CMD_PLAYBACK_FILE_END; -import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_RECORD_STATUS_COMPLETE; -import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_RECORD_STATUS_ERR_AUTHORITY; -import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_RECORD_STATUS_ERR_FAIL; -import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_RECORD_STATUS_ERR_PATH; -import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_RECORD_STATUS_ERR_RECORDING; -import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_RECORD_STATUS_ERR_SAVE; -import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_RECORD_STATUS_START; -import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_TALK_STATUS_ERR_AUTHORITY; -import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_TALK_STATUS_ERR_DEVICE_REPLY_FAIL; -import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_TALK_STATUS_ERR_HTTP_HOST; -import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_TALK_STATUS_ERR_HTTP_PARAMETER; -import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_TALK_STATUS_ERR_HTTP_TIMEOUT; -import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_TALK_STATUS_ERR_INIT; -import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_TALK_STATUS_ERR_NETWORK_ANOMALY; -import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_TALK_STATUS_ERR_SEND; -import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_TALK_STATUS_ERR_SERVER_DATA; -import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_TALK_STATUS_ERR_TALKING; -import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_TALK_STATUS_ERR_URL_GET; -import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_TALK_STATUS_PREPARE; -import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_TALK_STATUS_START; -import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_TALK_STATUS_STOP; -import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_VIDEO_STATUS_ERR_DEVICE_REPLY_FAIL; -import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_VIDEO_STATUS_ERR_HTTP_HOST; -import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_VIDEO_STATUS_ERR_HTTP_PARAMETER; -import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_VIDEO_STATUS_ERR_HTTP_TIMEOUT; -import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_VIDEO_STATUS_ERR_NETWORK_ANOMALY; -import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_VIDEO_STATUS_ERR_OPEN_FAIL; -import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_VIDEO_STATUS_ERR_OPEN_TIMEOUT; -import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_VIDEO_STATUS_ERR_PLAY_ABNORMAL; -import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_VIDEO_STATUS_ERR_SERVER_DATA; -import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_VIDEO_STATUS_ERR_URL_GET; -import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_VIDEO_STATUS_ERR_URL_INVALID; -import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_VIDEO_STATUS_PREPARE; -import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_VIDEO_STATUS_START; -import static com.jimi.jimivideoplayer.JMVideoStreamPlayerListener.STREAM_VIDEO_STATUS_STOP; +import static com.jimi.rn.rtmp.JMRTMPJSConstant.kOnStreamPlayerPlayStatus; +import static com.jimi.rn.rtmp.JMRTMPJSConstant.kOnStreamPlayerReceiveDeviceData; +import static com.jimi.rn.rtmp.JMRTMPJSConstant.kOnStreamPlayerReceiveFrameInfo; +import static com.jimi.rn.rtmp.JMRTMPJSConstant.kOnStreamPlayerRecordStatus; +import static com.jimi.rn.rtmp.JMRTMPJSConstant.kOnStreamPlayerTalkStatus; public class JMRTMPPlayerManager extends ReactContextBaseJavaModule { - private static String kOnStreamPlayerPlayStatus = "kOnStreamPlayerPlayStatus"; - private static String kOnStreamPlayerTalkStatus = "kOnStreamPlayerTalkStatus"; - private static String kOnStreamPlayerRecordStatus = "kOnStreamPlayerRecordStatus"; - private static String kOnStreamPlayerReceiveFrameInfo = "kOnStreamPlayerReceiveFrameInfo"; - private static String kOnStreamPlayerReceiveDeviceData = "kOnStreamPlayerReceiveDeviceData"; - private static JMVideoStreamPlayer gJMVideoStreamPlayer; private ReactApplicationContext mContext; + private GLMonitor glMonitor = null; private BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() { @Override @@ -94,9 +55,8 @@ public void onReceive(Context context, Intent intent) { new Thread(new Runnable() { public void run() { deInitialize(); - if (JMRTMPMonitorManager.glMonitor != null) { - JMRTMPMonitorManager.glMonitor = null; - } + glMonitor = null; + JMRTMPMonitorManager.removeGLMonitor(); } }); } @@ -123,16 +83,16 @@ public JMRTMPPlayerManager(ReactApplicationContext reactContext) { @Override public void onHostResume() { JMRTMPMonitorManager.isResume = true; - if (JMRTMPMonitorManager.glMonitor != null) { - JMRTMPMonitorManager.glMonitor.onResume(); + if (glMonitor != null) { + glMonitor.onResume(); } } @Override public void onHostPause() { JMRTMPMonitorManager.isResume = false; - if (JMRTMPMonitorManager.glMonitor != null) { - JMRTMPMonitorManager.glMonitor.onPause(); + if (glMonitor != null) { + glMonitor.onPause(); } } @@ -149,64 +109,18 @@ public void onHostDestroy() { @Nullable @Override public Map getConstants() { - Map constants = new HashMap<>(); - constants.put(kOnStreamPlayerPlayStatus, kOnStreamPlayerPlayStatus); - constants.put(kOnStreamPlayerTalkStatus, kOnStreamPlayerTalkStatus); - constants.put(kOnStreamPlayerRecordStatus, kOnStreamPlayerRecordStatus); - constants.put(kOnStreamPlayerReceiveFrameInfo, kOnStreamPlayerReceiveFrameInfo); - constants.put(kOnStreamPlayerReceiveDeviceData, kOnStreamPlayerReceiveDeviceData); - - constants.put("videoStatusPrepare", STREAM_VIDEO_STATUS_PREPARE); - constants.put("videoStatusStart", STREAM_VIDEO_STATUS_START); - constants.put("videoStatusStop", STREAM_VIDEO_STATUS_STOP); - constants.put("videoStatusErrURLGet", STREAM_VIDEO_STATUS_ERR_URL_GET); - constants.put("videoStatusErrURLInvalid", STREAM_VIDEO_STATUS_ERR_URL_INVALID); - constants.put("videoStatusErrOpenFail", STREAM_VIDEO_STATUS_ERR_OPEN_FAIL); - constants.put("videoStatusErrOpenTimeout", STREAM_VIDEO_STATUS_ERR_OPEN_TIMEOUT); - constants.put("videoStatusErrPlayAbnormal", STREAM_VIDEO_STATUS_ERR_PLAY_ABNORMAL); - constants.put("videoStatusErrHttpTimeout", STREAM_VIDEO_STATUS_ERR_HTTP_TIMEOUT); - constants.put("videoStatusErrHttpHost", STREAM_VIDEO_STATUS_ERR_HTTP_HOST); - constants.put("videoStatusErrHttpParameter", STREAM_VIDEO_STATUS_ERR_HTTP_PARAMETER); - constants.put("videoStatusErrServerData", STREAM_VIDEO_STATUS_ERR_SERVER_DATA); - constants.put("videoStatusErrDeviceReplayFail", STREAM_VIDEO_STATUS_ERR_DEVICE_REPLY_FAIL); - constants.put("videoStatusErrNetworkAnomaly", STREAM_VIDEO_STATUS_ERR_NETWORK_ANOMALY); - - constants.put("talkStatusPrepare", STREAM_TALK_STATUS_PREPARE); - constants.put("talkStatusStart", STREAM_TALK_STATUS_START); - constants.put("talkStatusStop", STREAM_TALK_STATUS_STOP); - constants.put("talkStatusErrURLGet", STREAM_TALK_STATUS_ERR_URL_GET); - constants.put("talkStatusErrInit", STREAM_TALK_STATUS_ERR_INIT); - constants.put("talkStatusErrTalking", STREAM_TALK_STATUS_ERR_TALKING); - constants.put("talkStatusErrSend", STREAM_TALK_STATUS_ERR_SEND); - constants.put("talkStatusErrHttpTimeout", STREAM_TALK_STATUS_ERR_HTTP_TIMEOUT); - constants.put("talkStatusErrHttpHost", STREAM_TALK_STATUS_ERR_HTTP_HOST); - constants.put("talkStatusErrHttpParameter", STREAM_TALK_STATUS_ERR_HTTP_PARAMETER); - constants.put("talkStatusErrServerData", STREAM_TALK_STATUS_ERR_SERVER_DATA); - constants.put("talkStatusErrDeviceReplayFail", STREAM_TALK_STATUS_ERR_DEVICE_REPLY_FAIL); - constants.put("talkStatusErrNetworkAnomaly", STREAM_TALK_STATUS_ERR_NETWORK_ANOMALY); - constants.put("talkStatusErrAuthority", STREAM_TALK_STATUS_ERR_AUTHORITY); - - constants.put("recordStatusStart", STREAM_RECORD_STATUS_START); - constants.put("recordStatusComplete", STREAM_RECORD_STATUS_COMPLETE); - constants.put("recordStatusErrRecording", STREAM_RECORD_STATUS_ERR_RECORDING); - constants.put("recordStatusErrFail", STREAM_RECORD_STATUS_ERR_FAIL); - constants.put("recordStatusErrSave", STREAM_RECORD_STATUS_ERR_SAVE); - constants.put("recordStatusErrPath", STREAM_RECORD_STATUS_ERR_PATH); - constants.put("recordStatusErrAuthority", STREAM_RECORD_STATUS_ERR_AUTHORITY); - - constants.put("receiveCmdPlaybackOneEnd", STREAM_RECEIVE_CMD_PLAYBACK_FILE_END); - constants.put("receiveCmdPlaybackAllEnd", STREAM_RECEIVE_CMD_PLAYBACK_ALL_END); - - return constants; + return JMRTMPJSConstant.constantsToExport(); } @ReactMethod public void initialize(String key, String secret, String imei) { - this.deInitialize(); + if (gJMVideoStreamPlayer != null) { + return; + } + glMonitor = JMRTMPMonitorManager.getGLMonitor(); gJMVideoStreamPlayer = new JMVideoStreamPlayer(mContext, key, secret, imei, null, mListener); - gJMVideoStreamPlayer.attachGlMonitor(JMRTMPMonitorManager.glMonitor); - JMRTMPMonitorManager.setIsResume(true); + gJMVideoStreamPlayer.attachGlMonitor(glMonitor); } @ReactMethod @@ -215,6 +129,7 @@ public void deInitialize() { gJMVideoStreamPlayer.addVideoStreamPlayerListener(null); gJMVideoStreamPlayer.deattachMonitor(); gJMVideoStreamPlayer.stop(); + gJMVideoStreamPlayer.release(); gJMVideoStreamPlayer = null; } } @@ -427,42 +342,59 @@ public void getVideoSize(Promise promise) { private JMVideoStreamPlayerListener mListener = new JMVideoStreamPlayerListener() { public void onStreamPlayerPlayStatus(int status, String errStr) { + WritableMap event = Arguments.createMap(); + if (status <= STREAM_VIDEO_STATUS_STOP) { + event.putInt("status", status); + } else { + event.putInt("status", status); + event.putInt("errCode", status); + if (status == STREAM_VIDEO_STATUS_ERR_URL_GET) { + event.putString("errMsg", errStr); + } + } + mContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class) + .emit(kOnStreamPlayerPlayStatus, event); } public void onStreamPlayerTalkStatus(int status, String errStr) { + WritableMap event = Arguments.createMap(); + if (status <= STREAM_TALK_STATUS_STOP) { + event.putInt("status", status); + } else { + event.putInt("status", status); + event.putInt("errCode", status); + if (status == STREAM_TALK_STATUS_ERR_URL_GET) { + event.putString("errMsg", errStr); + } + } + mContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class) + .emit(kOnStreamPlayerTalkStatus, event); } public void onStreamPlayerRecordStatus(int status, String filePath) { + WritableMap event = Arguments.createMap(); + event.putInt("status", status); + event.putString("filePath", (filePath != null) ? filePath : ""); + mContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class) + .emit(kOnStreamPlayerRecordStatus, event); } public void onStreamPlayerReceiveFrameInfo(FrameInfo frameInfo) { + WritableMap event = Arguments.createMap(); + event.putInt("width", frameInfo.videoWidth); + event.putInt("height", frameInfo.videoHeight); + event.putInt("videoBps", frameInfo.videoBps); + event.putInt("audioBPS", frameInfo.audioBps); + event.putInt("timestamp", (int)frameInfo.timestamp); + event.putInt("totalFrameCount", frameInfo.totalFrameCount); + mContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class) + .emit(kOnStreamPlayerReceiveFrameInfo, event); } public void onServerReceiveData(String data, int type) { JMLogUtil.d("onServerReceiveData: " + data + ",Type:" + type); - - try { - JSONObject jsonObject = new JSONObject(data); - if (jsonObject.has("code")) { - int code = jsonObject.getInt("code"); - switch (code) { - case JMVideoStreamPlayerListener.STREAM_RECEIVE_CMD_PLAYBACK_FILE_END://单个文件回放结束 - String filePath = jsonObject.getString("filePath"); - JMLogUtil.d(filePath.substring(filePath.lastIndexOf("/") + 1, filePath.length()) + "文件回放结束"); - break; - case JMVideoStreamPlayerListener.STREAM_RECEIVE_CMD_PLAYBACK_ALL_END://请求的全部回放文件播放结束 - JMLogUtil.d("回放文件已全部播完"); - break; - default: - JMLogUtil.d("自定义消息数据"); - break; - } - } else { - JMLogUtil.d("自定义消息数据"); - } - } catch (JSONException e) { - e.printStackTrace(); - } + mContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class) + .emit(kOnStreamPlayerReceiveDeviceData, data); } }; diff --git a/android/src/main/jniLibs/arm64-v8a/libJimiVideoPlayer.so b/android/src/main/jniLibs/arm64-v8a/libJimiVideoPlayer.so index 1fc6032..47c880c 100755 Binary files a/android/src/main/jniLibs/arm64-v8a/libJimiVideoPlayer.so and b/android/src/main/jniLibs/arm64-v8a/libJimiVideoPlayer.so differ diff --git a/android/src/main/jniLibs/armeabi-v7a/libJimiVideoPlayer.so b/android/src/main/jniLibs/armeabi-v7a/libJimiVideoPlayer.so index b4bbfa3..2bcb467 100755 Binary files a/android/src/main/jniLibs/armeabi-v7a/libJimiVideoPlayer.so and b/android/src/main/jniLibs/armeabi-v7a/libJimiVideoPlayer.so differ diff --git a/android/src/main/jniLibs/x86/libJimiVideoPlayer.so b/android/src/main/jniLibs/x86/libJimiVideoPlayer.so index 837351e..aac914e 100755 Binary files a/android/src/main/jniLibs/x86/libJimiVideoPlayer.so and b/android/src/main/jniLibs/x86/libJimiVideoPlayer.so differ diff --git a/example/App.js b/example/App.js index 4c16ea0..872cb3e 100755 --- a/example/App.js +++ b/example/App.js @@ -1,7 +1,8 @@ -import React, {Component} from 'react'; -import {Platform, StyleSheet, Image, Text, View, Dimensions, Button,TouchableOpacity,NativeModules,NativeEventEmitter} from 'react-native'; -import { JMRTMPMonitorView } from 'RNJimiRTMPPlayer'; -const {height, width} = Dimensions.get('window'); +import React, { Component } from 'react'; +import { Platform, StyleSheet, Image, Text, View, Dimensions, Button, TouchableOpacity, NativeModules, NativeEventEmitter } from 'react-native'; +import { JMRTMPMonitorView } from 'react-native-rtmp-player-jm'; +import RNFS from 'react-native-fs'; +const { height, width } = Dimensions.get('window'); const { JMRTMPPlayerManager } = NativeModules; @@ -19,23 +20,23 @@ export default class App extends Component { componentWillMount() { playStatusSubscription = this.state.rtmpManagerListener.addListener(JMRTMPPlayerManager.kOnStreamPlayerPlayStatus, (reminder) => { - console.log(reminder); - if (reminder.status == JMRTMPPlayerManager.videoStatusPrepare) { - console.log("准备播放视频"); - } else if (reminder.status == JMRTMPPlayerManager.videoStatusStart) { - console.log("视频已开始播放"); - } else if (reminder.status == JMRTMPPlayerManager.videoStatusStop) { - console.log("视频已停止播放"); - } else { - console.log("视频播放失败,Code:" + reminder.errCode + ",ErrMag:" + reminder.errMsg); - } - - }); - talkStatusSubscription = this.state.rtmpManagerListener.addListener(JMRTMPPlayerManager.kOnStreamPlayerTalkStatus, (reminder) => { console.log(reminder);}); - recordStatusSubscription = this.state.rtmpManagerListener.addListener(JMRTMPPlayerManager.kOnStreamPlayerRecordStatus, (reminder) => { console.log(reminder);}); + console.log(reminder); + if (reminder.status == JMRTMPPlayerManager.videoStatusPrepare) { + console.log("准备播放视频"); + } else if (reminder.status == JMRTMPPlayerManager.videoStatusStart) { + console.log("视频已开始播放"); + } else if (reminder.status == JMRTMPPlayerManager.videoStatusStop) { + console.log("视频已停止播放"); + } else { + console.log("视频播放失败,Code:" + reminder.errCode + ",ErrMag:" + reminder.errMsg); + } + + }); + talkStatusSubscription = this.state.rtmpManagerListener.addListener(JMRTMPPlayerManager.kOnStreamPlayerTalkStatus, (reminder) => { console.log(reminder); }); + recordStatusSubscription = this.state.rtmpManagerListener.addListener(JMRTMPPlayerManager.kOnStreamPlayerRecordStatus, (reminder) => { console.log(reminder); }); frameInfoSubscription = this.state.rtmpManagerListener.addListener(JMRTMPPlayerManager.kOnStreamPlayerReceiveFrameInfo, (reminder) => { //console.log(reminder); - }); - receiveDeviceSubscription = this.state.rtmpManagerListener.addListener(JMRTMPPlayerManager.kOnStreamPlayerReceiveDeviceData, (reminder) => { console.log(reminder);}); + }); + receiveDeviceSubscription = this.state.rtmpManagerListener.addListener(JMRTMPPlayerManager.kOnStreamPlayerReceiveDeviceData, (reminder) => { console.log(reminder); }); } componentWillUnmount() { @@ -49,55 +50,55 @@ export default class App extends Component { render() { return ( - - + - - - - {this.clickedInitSDK()}}> - 初始化SDK - - {this.clickedStartPlay()}}> - 开始 - - {this.clickedStopPlay()}}> - 停止 - - {this.clickedStartPlayback()}}> - 回放 - - {this.clickedStartRecording()}}> - 开始录制 - - {this.clickedStopRecording()}}> - 停止录制 - - + + + + { this.clickedInitSDK() }}> + 初始化SDK + + { this.clickedStartPlay() }}> + 开始 + + { this.clickedStopPlay() }}> + 停止 + + { this.clickedStartPlayback() }}> + 回放 + + { this.clickedStartRecording() }}> + 开始录制 + + { this.clickedStopRecording() }}> + 停止录制 + + - - {this.clickedReleaseSDK()}}> - 释放SDK - - {this.clickedStartTalk()}}> - 开始对讲 - - {this.clickedInitSDK()}}> - 停止对讲 - - {this.clickedSendCustomRequest()}}> - 发送消息 - - {this.clickedSnapshot()}}> - 拍照 - - {this.clickedMute()}}> - 静音 - + + { this.clickedReleaseSDK() }}> + 释放SDK + + { this.clickedStartTalk() }}> + 开始对讲 + + { this.clickedInitSDK() }}> + 停止对讲 + + { this.clickedSendCustomRequest() }}> + 发送消息 + + { this.clickedSnapshot() }}> + 拍照 + + { this.clickedMute() }}> + 静音 + - + ); } @@ -122,7 +123,9 @@ export default class App extends Component { } clickedStartRecording() { - JMRTMPPlayerManager.startRecording("./123.mp4") //需要具体的地址,比如:"/Users/lzj/Library/Developer/CoreSimulator/Devices/021EF370-EB9F-4D6D-808C-90D44B213009/data/Containers/Data/Application/307AB34A-652E-4F56-AE02-B7C82A75F3DB/tmp/123.mp4" + const path = Platform.OS === 'android' ? (RNFS.ExternalStorageDirectoryPath + "/") : RNFS.TemporaryDirectoryPath; + console.log(path); + JMRTMPPlayerManager.startRecording(path + "123.mp4") //需要具体的地址,比如:"/Users/lzj/Library/Developer/CoreSimulator/Devices/021EF370-EB9F-4D6D-808C-90D44B213009/data/Containers/Data/Application/307AB34A-652E-4F56-AE02-B7C82A75F3DB/tmp/123.mp4" } clickedStopRecording() { @@ -138,28 +141,30 @@ export default class App extends Component { } clickedSendCustomRequest() { - JMRTMPPlayerManager.sendCustomRequest({"test": "123"}).then(data=>{ - console.log(data); - }).catch(e=>{ - console.log(e); - }); + JMRTMPPlayerManager.sendCustomRequest({ "test": "123" }).then(data => { + console.log(data); + }).catch(e => { + console.log(e); + }); } clickedSnapshot() { - //需要具体的地址,比如:"/Users/lzj/Library/Developer/CoreSimulator/Devices/021EF370-EB9F-4D6D-808C-90D44B213009/data/Containers/Data/Application/307AB34A-652E-4F56-AE02-B7C82A75F3DB/tmp/123.png" - JMRTMPPlayerManager.snapshot("./123.png").then(data=>{ - console.log(data); - }).catch(e=>{ - console.log(e); - }); + //需要具体的地址,比如:"/Users/lzj/Library/Developer/CoreSimulator/Devices/021EF370-EB9F-4D6D-808C-90D44B213009/data/Containers/Data/Application/307AB34A-652E-4F56-AE02-B7C82A75F3DB/tmp/123.png" + const path = Platform.OS === 'android' ? (RNFS.ExternalStorageDirectoryPath + "/") : RNFS.TemporaryDirectoryPath; + console.log(path); + JMRTMPPlayerManager.snapshot(path + "123.png").then(data => { + console.log(data); + }).catch(e => { + console.log(e); + }); } clickedSwitchCamera() { - JMRTMPPlayerManager.switchCamera(false, false).then(data=>{ - console.log(data); - }).catch(e=>{ - console.log(e); - }); + JMRTMPPlayerManager.switchCamera(false, false).then(data => { + console.log(data); + }).catch(e => { + console.log(e); + }); } clickedStopAll() { @@ -167,7 +172,7 @@ export default class App extends Component { } clickedMute() { - this.setState({mute: !this.state.mute}, () => { + this.setState({ mute: !this.state.mute }, () => { JMRTMPPlayerManager.setMute(this.state.mute); }); } @@ -175,18 +180,18 @@ export default class App extends Component { const styles = StyleSheet.create({ container: { - flex: 1, - justifyContent: 'center', - alignItems: 'center', - backgroundColor: '#F5FCFF', + flex: 1, + justifyContent: 'center', + alignItems: 'center', + backgroundColor: '#F5FCFF', }, - btn:{ - justifyContent:'center', - alignItems:'center', - backgroundColor:'#AAFCFF', - borderColor:'#ca6', - borderWidth:1, - width: (width-15)/6 + btn: { + justifyContent: 'center', + alignItems: 'center', + backgroundColor: '#AAFCFF', + borderColor: '#ca6', + borderWidth: 1, + width: (width - 15) / 6 } }); diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index d32b2a0..1251efb 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -145,7 +145,9 @@ dependencies { implementation fileTree(dir: "libs", include: ["*.jar"]) implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" implementation "com.facebook.react:react-native:+" - implementation project(':RNJimiRTMPPlayer') + + implementation project(':react-native-fs') + implementation project(':react-native-rtmp-player-jm') } task copyDownloadableDepsToLibs(type: Copy) { diff --git a/example/android/app/src/main/java/com/rn/MainApplication.java b/example/android/app/src/main/java/com/rn/MainApplication.java index 37ec377..48a4cfb 100644 --- a/example/android/app/src/main/java/com/rn/MainApplication.java +++ b/example/android/app/src/main/java/com/rn/MainApplication.java @@ -1,6 +1,5 @@ package com.rn; -import android.Manifest; import android.app.Application; import com.facebook.react.ReactApplication; @@ -10,6 +9,7 @@ import com.facebook.soloader.SoLoader; import com.jimi.rn.rtmp.JMRTMPPlayerPackage; +import com.rnfs.RNFSPackage; import java.util.Arrays; import java.util.List; @@ -26,6 +26,7 @@ public boolean getUseDeveloperSupport() { protected List getPackages() { return Arrays.asList( new MainReactPackage(), + new RNFSPackage(), new JMRTMPPlayerPackage() ); } diff --git a/example/android/settings.gradle b/example/android/settings.gradle index 913c17f..d93c055 100644 --- a/example/android/settings.gradle +++ b/example/android/settings.gradle @@ -1,5 +1,9 @@ rootProject.name = 'example' -include ':RNJimiRTMPPlayer' -project(':RNJimiRTMPPlayer').projectDir = new File(rootProject.projectDir, '../node_modules/RNJimiRTMPPlayer/android') + +include ':react-native-fs' +project(':react-native-fs').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fs/android') + +include ':react-native-rtmp-player-jm' +project(':react-native-rtmp-player-jm').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-rtmp-player-jm/android') include ':app' diff --git a/example/ios/Podfile b/example/ios/Podfile index 7e56ace..699383e 100644 --- a/example/ios/Podfile +++ b/example/ios/Podfile @@ -13,18 +13,22 @@ target 'example' do 'RCTText', 'RCTNetwork', 'RCTWebSocket', - 'RCTAnimation' + 'RCTAnimation', + 'RCTImage', ] pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga' pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec' pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec' pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec' - pod 'RNJimiRTMPPlayer', :podspec => '../node_modules/RNJimiRTMPPlayer/RNJimiRTMPPlayer.podspec' + pod 'react-native-rtmp-player-jm', :podspec => '../node_modules/react-native-rtmp-player-jm/react-native-rtmp-player-jm.podspec' + + pod 'RNFS', :podspec => '../node_modules/react-native-fs' target 'example-tvOSTests' do inherit! :search_paths # Pods for testing + end end diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index e4cba57..c170670 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -8,6 +8,8 @@ PODS: - glog (0.3.5) - React (0.57.8): - React/Core (= 0.57.8) + - react-native-rtmp-player-jm (0.0.1): + - React - React/Core (0.57.8): - yoga (= 0.57.8.React) - React/CxxBridge (0.57.8): @@ -32,6 +34,9 @@ PODS: - React/Core - React/RCTBlob (0.57.8): - React/Core + - React/RCTImage (0.57.8): + - React/Core + - React/RCTNetwork - React/RCTNetwork (0.57.8): - React/Core - React/RCTText (0.57.8): @@ -40,7 +45,7 @@ PODS: - React/Core - React/fishhook - React/RCTBlob - - RNJimiRTMPPlayer (0.0.1): + - RNFS (2.13.3): - React - yoga (0.57.8.React) @@ -48,14 +53,16 @@ DEPENDENCIES: - DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`) - Folly (from `../node_modules/react-native/third-party-podspecs/Folly.podspec`) - glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`) + - react-native-rtmp-player-jm (from `../node_modules/react-native-rtmp-player-jm/react-native-rtmp-player-jm.podspec`) - React/Core (from `../node_modules/react-native`) - React/CxxBridge (from `../node_modules/react-native`) - React/DevSupport (from `../node_modules/react-native`) - React/RCTAnimation (from `../node_modules/react-native`) + - React/RCTImage (from `../node_modules/react-native`) - React/RCTNetwork (from `../node_modules/react-native`) - React/RCTText (from `../node_modules/react-native`) - React/RCTWebSocket (from `../node_modules/react-native`) - - RNJimiRTMPPlayer (from `../node_modules/RNJimiRTMPPlayer/RNJimiRTMPPlayer.podspec`) + - RNFS (from `../node_modules/react-native-fs`) - yoga (from `../node_modules/react-native/ReactCommon/yoga`) SPEC REPOS: @@ -71,8 +78,10 @@ EXTERNAL SOURCES: :podspec: "../node_modules/react-native/third-party-podspecs/glog.podspec" React: :path: "../node_modules/react-native" - RNJimiRTMPPlayer: - :podspec: "../node_modules/RNJimiRTMPPlayer/RNJimiRTMPPlayer.podspec" + react-native-rtmp-player-jm: + :podspec: "../node_modules/react-native-rtmp-player-jm/react-native-rtmp-player-jm.podspec" + RNFS: + :podspec: "../node_modules/react-native-fs" yoga: :path: "../node_modules/react-native/ReactCommon/yoga" @@ -82,9 +91,10 @@ SPEC CHECKSUMS: Folly: c89ac2d5c6ab169cd7397ef27485c44f35f742c7 glog: e8acf0ebbf99759d3ff18c86c292a5898282dcde React: 1fe0eb13d90b625d94c3b117c274dcfd2e760e11 - RNJimiRTMPPlayer: 8555fc4e3b04cf9ec9905929b95a6aadade672ab + react-native-rtmp-player-jm: acf72fc9cc62012a0457a004714e2fd58497bc91 + RNFS: c9bbde46b0d59619f8e7b735991c60e0f73d22c1 yoga: b1ce48b6cf950b98deae82838f5173ea7cf89e85 -PODFILE CHECKSUM: 248638db141d64aaae0fc8bba92f388a7d7ee947 +PODFILE CHECKSUM: 6d1488ad68c40b329e9eebbde368469258d9e2d0 COCOAPODS: 1.5.3 diff --git a/example/ios/example.xcodeproj/project.pbxproj b/example/ios/example.xcodeproj/project.pbxproj index 3f3a98c..e813f67 100644 --- a/example/ios/example.xcodeproj/project.pbxproj +++ b/example/ios/example.xcodeproj/project.pbxproj @@ -1123,7 +1123,7 @@ ); inputPaths = ( "${SRCROOT}/Pods/Target Support Files/Pods-example/Pods-example-frameworks.sh", - "${PODS_ROOT}/RNJimiRTMPPlayer/ios/RNJimiRTMPPlayer/JimiVideoPlayer.framework", + "${PODS_ROOT}/react-native-rtmp-player-jm/ios/RNJimiRTMPPlayer/JimiVideoPlayer.framework", ); name = "[CP] Embed Pods Frameworks"; outputFileListPaths = ( @@ -1247,10 +1247,7 @@ CURRENT_PROJECT_VERSION = 1; DEAD_CODE_STRIPPING = NO; DEVELOPMENT_TEAM = EB9K2L27BQ; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/example/RNJimiRTMPPlayer", - ); + FRAMEWORK_SEARCH_PATHS = "$(inherited)"; HEADER_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = example/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -1283,10 +1280,7 @@ CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = EB9K2L27BQ; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/example/RNJimiRTMPPlayer", - ); + FRAMEWORK_SEARCH_PATHS = "$(inherited)"; HEADER_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = example/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -1297,7 +1291,6 @@ "\"${PODS_CONFIGURATION_BUILD_DIR}/React\"", "\"${PODS_CONFIGURATION_BUILD_DIR}/glog\"", "\"${PODS_CONFIGURATION_BUILD_DIR}/yoga\"", - "$(SRCROOT)/RNJimiRTMPPlayer", ); OTHER_LDFLAGS = ( "$(inherited)", diff --git a/example/package.json b/example/package.json index f0d3172..0512e11 100644 --- a/example/package.json +++ b/example/package.json @@ -9,7 +9,8 @@ "dependencies": { "react": "16.6.3", "react-native": "0.57.8", - "react-native-rtmp-player-jm": "^0.0.1" + "react-native-rtmp-player-jm": "1.0.0", + "react-native-fs": "^2.13.3" }, "devDependencies": { "babel-core": "^7.0.0-bridge.0", diff --git a/ios/RNJimiRTMPPlayer.xcodeproj/project.pbxproj b/ios/RNJimiRTMPPlayer.xcodeproj/project.pbxproj index ae66b34..0f7ea2c 100644 --- a/ios/RNJimiRTMPPlayer.xcodeproj/project.pbxproj +++ b/ios/RNJimiRTMPPlayer.xcodeproj/project.pbxproj @@ -12,6 +12,8 @@ 0C16950A2314C2AA00085C6D /* JMRTMPPlayerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0C1695082314C2AA00085C6D /* JMRTMPPlayerManager.m */; }; 0C16954E2315077100085C6D /* JMRTMPMonitorManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0C16954C2315077100085C6D /* JMRTMPMonitorManager.m */; }; 0C16954F2315077100085C6D /* JMRTMPMonitorManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 0C16954D2315077100085C6D /* JMRTMPMonitorManager.h */; }; + 0C30C25C2334778F009630F6 /* JMRTMPJSConstant.h in Headers */ = {isa = PBXBuildFile; fileRef = 0C30C25A2334778F009630F6 /* JMRTMPJSConstant.h */; }; + 0C30C25D2334778F009630F6 /* JMRTMPJSConstant.m in Sources */ = {isa = PBXBuildFile; fileRef = 0C30C25B2334778F009630F6 /* JMRTMPJSConstant.m */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -21,6 +23,8 @@ 0C1695082314C2AA00085C6D /* JMRTMPPlayerManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JMRTMPPlayerManager.m; sourceTree = ""; }; 0C16954C2315077100085C6D /* JMRTMPMonitorManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JMRTMPMonitorManager.m; sourceTree = ""; }; 0C16954D2315077100085C6D /* JMRTMPMonitorManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JMRTMPMonitorManager.h; sourceTree = ""; }; + 0C30C25A2334778F009630F6 /* JMRTMPJSConstant.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JMRTMPJSConstant.h; sourceTree = ""; }; + 0C30C25B2334778F009630F6 /* JMRTMPJSConstant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JMRTMPJSConstant.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -59,6 +63,8 @@ 0C1695082314C2AA00085C6D /* JMRTMPPlayerManager.m */, 0C16954D2315077100085C6D /* JMRTMPMonitorManager.h */, 0C16954C2315077100085C6D /* JMRTMPMonitorManager.m */, + 0C30C25A2334778F009630F6 /* JMRTMPJSConstant.h */, + 0C30C25B2334778F009630F6 /* JMRTMPJSConstant.m */, ); path = RNJimiRTMPPlayer; sourceTree = ""; @@ -71,6 +77,7 @@ buildActionMask = 2147483647; files = ( 0C1695092314C2AA00085C6D /* JMRTMPPlayerManager.h in Headers */, + 0C30C25C2334778F009630F6 /* JMRTMPJSConstant.h in Headers */, 0C16954F2315077100085C6D /* JMRTMPMonitorManager.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; @@ -144,6 +151,7 @@ files = ( 0C16954E2315077100085C6D /* JMRTMPMonitorManager.m in Sources */, 0C16950A2314C2AA00085C6D /* JMRTMPPlayerManager.m in Sources */, + 0C30C25D2334778F009630F6 /* JMRTMPJSConstant.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/ios/RNJimiRTMPPlayer/JMRTMPJSConstant.h b/ios/RNJimiRTMPPlayer/JMRTMPJSConstant.h new file mode 100644 index 0000000..8ba59bd --- /dev/null +++ b/ios/RNJimiRTMPPlayer/JMRTMPJSConstant.h @@ -0,0 +1,24 @@ +// +// JMRTMPJSConstant.h +// DoubleConversion +// +// Created by lzj on 2019/9/20. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +extern NSString *const kOnStreamPlayerPlayStatus; +extern NSString *const kOnStreamPlayerTalkStatus; +extern NSString *const kOnStreamPlayerRecordStatus; +extern NSString *const kOnStreamPlayerReceiveFrameInfo; +extern NSString *const kOnStreamPlayerReceiveDeviceData; + +@interface JMRTMPJSConstant : NSObject + ++ (NSDictionary *)constantsToExport; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios/RNJimiRTMPPlayer/JMRTMPJSConstant.m b/ios/RNJimiRTMPPlayer/JMRTMPJSConstant.m new file mode 100644 index 0000000..6cbc4ec --- /dev/null +++ b/ios/RNJimiRTMPPlayer/JMRTMPJSConstant.m @@ -0,0 +1,77 @@ +// +// JMRTMPJSConstant.m +// DoubleConversion +// +// Created by lzj on 2019/9/20. +// + +#import "JMRTMPJSConstant.h" +#import + +NSString *const kOnStreamPlayerPlayStatus = @"kOnStreamPlayerPlayStatus"; +NSString *const kOnStreamPlayerTalkStatus = @"kOnStreamPlayerTalkStatus"; +NSString *const kOnStreamPlayerRecordStatus = @"kOnStreamPlayerRecordStatus"; +NSString *const kOnStreamPlayerReceiveFrameInfo = @"kOnStreamPlayerReceiveFrameInfo"; +NSString *const kOnStreamPlayerReceiveDeviceData = @"kOnStreamPlayerReceiveDeviceData"; + +@implementation JMRTMPJSConstant + ++ (NSDictionary *)constantsToExport +{ + NSMutableDictionary *dic = [NSMutableDictionary dictionary]; + [dic addEntriesFromDictionary:@{kOnStreamPlayerPlayStatus: kOnStreamPlayerPlayStatus, + kOnStreamPlayerTalkStatus: kOnStreamPlayerTalkStatus, + kOnStreamPlayerRecordStatus: kOnStreamPlayerRecordStatus, + kOnStreamPlayerReceiveFrameInfo: kOnStreamPlayerReceiveFrameInfo, + kOnStreamPlayerReceiveDeviceData: kOnStreamPlayerReceiveDeviceData + }]; + + [dic addEntriesFromDictionary:@{@"videoStatusPrepare": @(STREAM_VIDEO_STATUS_PREPARE), + @"videoStatusStart": @(STREAM_VIDEO_STATUS_START), + @"videoStatusStop": @(STREAM_VIDEO_STATUS_STOP), + @"videoStatusErrURLGet": @(STREAM_VIDEO_STATUS_ERR_URL_GET), + @"videoStatusErrURLInvalid": @(STREAM_VIDEO_STATUS_ERR_URL_INVALID), + @"videoStatusErrOpenFail": @(STREAM_VIDEO_STATUS_ERR_OPEN_FAIL), + @"videoStatusErrOpenTimeout": @(STREAM_VIDEO_STATUS_ERR_OPEN_TIMEOUT), + @"videoStatusErrPlayAbnormal": @(STREAM_VIDEO_STATUS_ERR_PLAY_ABNORMAL), + @"videoStatusErrHttpTimeout": @(STREAM_VIDEO_STATUS_ERR_HTTP_TIMEOUT), + @"videoStatusErrHttpHost": @(STREAM_VIDEO_STATUS_ERR_HTTP_HOST), + @"videoStatusErrHttpParameter": @(STREAM_VIDEO_STATUS_ERR_HTTP_PARAMETER), + @"videoStatusErrServerData": @(STREAM_VIDEO_STATUS_ERR_SERVER_DATA), + @"videoStatusErrDeviceReplayFail": @(STREAM_VIDEO_STATUS_ERR_DEVICE_REPLY_FAIL), + @"videoStatusErrNetworkAnomaly": @(STREAM_VIDEO_STATUS_ERR_NETWORK_ANOMALY) + }]; + + [dic addEntriesFromDictionary:@{@"talkStatusPrepare": @(STREAM_TALK_STATUS_PREPARE), + @"talkStatusStart": @(STREAM_TALK_STATUS_START), + @"talkStatusStop": @(STREAM_TALK_STATUS_STOP), + @"talkStatusErrURLGet": @(STREAM_TALK_STATUS_ERR_URL_GET), + @"talkStatusErrInit": @(STREAM_TALK_STATUS_ERR_INIT), + @"talkStatusErrTalking": @(STREAM_TALK_STATUS_ERR_TALKING), + @"talkStatusErrSend": @(STREAM_TALK_STATUS_ERR_SEND), + @"talkStatusErrHttpTimeout": @(STREAM_TALK_STATUS_ERR_HTTP_TIMEOUT), + @"talkStatusErrHttpHost": @(STREAM_TALK_STATUS_ERR_HTTP_HOST), + @"talkStatusErrHttpParameter": @(STREAM_TALK_STATUS_ERR_HTTP_PARAMETER), + @"talkStatusErrServerData": @(STREAM_TALK_STATUS_ERR_SERVER_DATA), + @"talkStatusErrDeviceReplayFail": @(STREAM_TALK_STATUS_ERR_DEVICE_REPLY_FAIL), + @"talkStatusErrNetworkAnomaly": @(STREAM_TALK_STATUS_ERR_NETWORK_ANOMALY), + @"talkStatusErrAuthority": @(STREAM_TALK_STATUS_ERR_AUTHORITY) + }]; + + [dic addEntriesFromDictionary:@{@"recordStatusStart": @(STREAM_RECORD_STATUS_START), + @"recordStatusComplete": @(STREAM_RECORD_STATUS_COMPLETE), + @"recordStatusErrRecording": @(STREAM_RECORD_STATUS_ERR_RECORDING), + @"recordStatusErrFail": @(STREAM_RECORD_STATUS_ERR_FAIL), + @"recordStatusErrSave": @(STREAM_RECORD_STATUS_ERR_SAVE), + @"recordStatusErrPath": @(STREAM_RECORD_STATUS_ERR_PATH), + @"recordStatusErrAuthority": @(STREAM_RECORD_STATUS_ERR_AUTHORITY), + }]; + + [dic addEntriesFromDictionary:@{@"receiveCmdPlaybackOneEnd": @(STREAM_RECEIVE_CMD_PLAYBACK_FILE_END), + @"receiveCmdPlaybackAllEnd": @(STREAM_RECEIVE_CMD_PLAYBACK_ALL_END), + }]; + + return dic; +} + +@end diff --git a/ios/RNJimiRTMPPlayer/JMRTMPPlayerManager.m b/ios/RNJimiRTMPPlayer/JMRTMPPlayerManager.m index e40fedb..7fce862 100644 --- a/ios/RNJimiRTMPPlayer/JMRTMPPlayerManager.m +++ b/ios/RNJimiRTMPPlayer/JMRTMPPlayerManager.m @@ -8,15 +8,10 @@ #import "JMRTMPPlayerManager.h" #import "JMRTMPMonitorManager.h" +#import "JMRTMPJSConstant.h" #import #import -NSString *const kOnStreamPlayerPlayStatus = @"kOnStreamPlayerPlayStatus"; -NSString *const kOnStreamPlayerTalkStatus = @"kOnStreamPlayerTalkStatus"; -NSString *const kOnStreamPlayerRecordStatus = @"kOnStreamPlayerRecordStatus"; -NSString *const kOnStreamPlayerReceiveFrameInfo = @"kOnStreamPlayerReceiveFrameInfo"; -NSString *const kOnStreamPlayerReceiveDeviceData = @"kOnStreamPlayerReceiveDeviceData"; - JMVideoStreamPlayer *gJMVideoStreamPlayer = nil; @interface JMRTMPPlayerManager() @@ -44,60 +39,7 @@ - (void)stopObserving { - (NSDictionary *)constantsToExport { - NSMutableDictionary *dic = [NSMutableDictionary dictionary]; - [dic addEntriesFromDictionary:@{kOnStreamPlayerPlayStatus: kOnStreamPlayerPlayStatus, - kOnStreamPlayerTalkStatus: kOnStreamPlayerTalkStatus, - kOnStreamPlayerRecordStatus: kOnStreamPlayerRecordStatus, - kOnStreamPlayerReceiveFrameInfo: kOnStreamPlayerReceiveFrameInfo, - kOnStreamPlayerReceiveDeviceData: kOnStreamPlayerReceiveDeviceData - }]; - - [dic addEntriesFromDictionary:@{@"videoStatusPrepare": @(STREAM_VIDEO_STATUS_PREPARE), - @"videoStatusStart": @(STREAM_VIDEO_STATUS_START), - @"videoStatusStop": @(STREAM_VIDEO_STATUS_STOP), - @"videoStatusErrURLGet": @(STREAM_VIDEO_STATUS_ERR_URL_GET), - @"videoStatusErrURLInvalid": @(STREAM_VIDEO_STATUS_ERR_URL_INVALID), - @"videoStatusErrOpenFail": @(STREAM_VIDEO_STATUS_ERR_OPEN_FAIL), - @"videoStatusErrOpenTimeout": @(STREAM_VIDEO_STATUS_ERR_OPEN_TIMEOUT), - @"videoStatusErrPlayAbnormal": @(STREAM_VIDEO_STATUS_ERR_PLAY_ABNORMAL), - @"videoStatusErrHttpTimeout": @(STREAM_VIDEO_STATUS_ERR_HTTP_TIMEOUT), - @"videoStatusErrHttpHost": @(STREAM_VIDEO_STATUS_ERR_HTTP_HOST), - @"videoStatusErrHttpParameter": @(STREAM_VIDEO_STATUS_ERR_HTTP_PARAMETER), - @"videoStatusErrServerData": @(STREAM_VIDEO_STATUS_ERR_SERVER_DATA), - @"videoStatusErrDeviceReplayFail": @(STREAM_VIDEO_STATUS_ERR_DEVICE_REPLY_FAIL), - @"videoStatusErrNetworkAnomaly": @(STREAM_VIDEO_STATUS_ERR_NETWORK_ANOMALY) - }]; - - [dic addEntriesFromDictionary:@{@"talkStatusPrepare": @(STREAM_TALK_STATUS_PREPARE), - @"talkStatusStart": @(STREAM_TALK_STATUS_START), - @"talkStatusStop": @(STREAM_TALK_STATUS_STOP), - @"talkStatusErrURLGet": @(STREAM_TALK_STATUS_ERR_URL_GET), - @"talkStatusErrInit": @(STREAM_TALK_STATUS_ERR_INIT), - @"talkStatusErrTalking": @(STREAM_TALK_STATUS_ERR_TALKING), - @"talkStatusErrSend": @(STREAM_TALK_STATUS_ERR_SEND), - @"talkStatusErrHttpTimeout": @(STREAM_TALK_STATUS_ERR_HTTP_TIMEOUT), - @"talkStatusErrHttpHost": @(STREAM_TALK_STATUS_ERR_HTTP_HOST), - @"talkStatusErrHttpParameter": @(STREAM_TALK_STATUS_ERR_HTTP_PARAMETER), - @"talkStatusErrServerData": @(STREAM_TALK_STATUS_ERR_SERVER_DATA), - @"talkStatusErrDeviceReplayFail": @(STREAM_TALK_STATUS_ERR_DEVICE_REPLY_FAIL), - @"talkStatusErrNetworkAnomaly": @(STREAM_TALK_STATUS_ERR_NETWORK_ANOMALY), - @"talkStatusErrAuthority": @(STREAM_TALK_STATUS_ERR_AUTHORITY) - }]; - - [dic addEntriesFromDictionary:@{@"recordStatusStart": @(STREAM_RECORD_STATUS_START), - @"recordStatusComplete": @(STREAM_RECORD_STATUS_COMPLETE), - @"recordStatusErrRecording": @(STREAM_RECORD_STATUS_ERR_RECORDING), - @"recordStatusErrFail": @(STREAM_RECORD_STATUS_ERR_FAIL), - @"recordStatusErrSave": @(STREAM_RECORD_STATUS_ERR_SAVE), - @"recordStatusErrPath": @(STREAM_RECORD_STATUS_ERR_PATH), - @"recordStatusErrAuthority": @(STREAM_RECORD_STATUS_ERR_AUTHORITY), - }]; - - [dic addEntriesFromDictionary:@{@"receiveCmdPlaybackOneEnd": @(STREAM_RECEIVE_CMD_PLAYBACK_FILE_END), - @"receiveCmdPlaybackAllEnd": @(STREAM_RECEIVE_CMD_PLAYBACK_ALL_END), - }]; - - return dic; + return [JMRTMPJSConstant constantsToExport]; } - (void)sendEventWithName:(NSString *)eventName body:(id)body @@ -112,7 +54,7 @@ - (void)sendEventWithName:(NSString *)eventName body:(id)body RCT_EXPORT_METHOD(initialize:(NSString *)key secret:(NSString *)secret imei:(NSString *_Nonnull)imei) { - [self deInitialize]; + if (gJMVideoStreamPlayer != nil) return; gJMVideoStreamPlayer = [[JMVideoStreamPlayer alloc] initWithKey:key secret:secret imei:imei token:nil]; gJMVideoStreamPlayer.delegate = self; @@ -167,37 +109,41 @@ - (void)sendEventWithName:(NSString *)eventName body:(id)body } RCT_EXPORT_METHOD(snapshot:(NSString *)filePath resolve:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) { - UIImage *img = [gJMVideoStreamPlayer snapshot]; - if (img) { - if (!filePath) { - filePath = NSTemporaryDirectory(); - } else if ([filePath hasPrefix:@"./"]) { - filePath = [NSTemporaryDirectory() stringByAppendingPathComponent:[filePath substringFromIndex:1]]; - } - NSString *extensionName = filePath.pathExtension; - if (!extensionName || !extensionName.length) { - if (![[NSFileManager defaultManager] fileExistsAtPath:filePath]) { - [[NSFileManager defaultManager] createDirectoryAtPath:filePath withIntermediateDirectories:YES attributes:nil error:nil]; + __block NSString *filePathT = filePath; + dispatch_async(dispatch_get_main_queue(), ^{ + UIImage *img = [gJMVideoStreamPlayer snapshot]; + if (img) { + if (!filePathT) { + filePathT = NSTemporaryDirectory(); + } else if ([filePathT hasPrefix:@"./"]) { + filePathT = [NSTemporaryDirectory() stringByAppendingPathComponent:[filePathT substringFromIndex:1]]; } - filePath = [filePath stringByAppendingPathComponent:@"tempSnapshot.png"]; - } else { - NSArray *arr = [filePath pathComponents]; - NSString *fileName = [arr lastObject]; - NSString *path = [filePath substringToIndex:filePath.length - fileName.length]; - if (![[NSFileManager defaultManager] fileExistsAtPath:path]) { - [[NSFileManager defaultManager] createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:nil]; + + NSString *extensionName = filePathT.pathExtension; + if (!extensionName || !extensionName.length) { + if (![[NSFileManager defaultManager] fileExistsAtPath:filePathT]) { + [[NSFileManager defaultManager] createDirectoryAtPath:filePathT withIntermediateDirectories:YES attributes:nil error:nil]; + } + filePathT = [filePathT stringByAppendingPathComponent:@"tempSnapshot.png"]; + } else { + NSArray *arr = [filePathT pathComponents]; + NSString *fileName = [arr lastObject]; + NSString *path = [filePathT substringToIndex:filePathT.length - fileName.length]; + if (![[NSFileManager defaultManager] fileExistsAtPath:path]) { + [[NSFileManager defaultManager] createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:nil]; + } } - } - if ([UIImagePNGRepresentation(img) writeToFile:filePath atomically:YES]) { - resolve(filePath); + if ([UIImagePNGRepresentation(img) writeToFile:filePathT atomically:YES]) { + resolve(filePathT); + } else { + reject(@"-2", @"Failed to save image", nil); + } } else { - reject(@"-2", @"Failed to save image", nil); + reject(@"-1", @"Failed to do snapshot", nil); } - } else { - reject(@"-1", @"Failed to do snapshot", nil); - } + }); } RCT_EXPORT_METHOD(startRecording:(NSString *)filePath) { diff --git a/ios/RNJimiRTMPPlayer/JimiVideoPlayer.framework/ChangeLog b/ios/RNJimiRTMPPlayer/JimiVideoPlayer.framework/ChangeLog index fca2cba..2402268 100644 --- a/ios/RNJimiRTMPPlayer/JimiVideoPlayer.framework/ChangeLog +++ b/ios/RNJimiRTMPPlayer/JimiVideoPlayer.framework/ChangeLog @@ -1,5 +1,23 @@ //更新日志 +1.3.5 //2019091901 +1、优化在释放SDK时,偶尔之前的请求可能会导致闪退的问题; + +1.3.4 //2019091601 +1、修复部分BUG,提升性能; +2、优化SDK手动调用时的初始化及释放接口; +3、优化切换服务器时更新登录; + +1.3.3 //2019072501 +1、修复PCM音频播放器在播放低采样率音频的情况下会出现静电噪音的问题; +2、视频播放器音频流加入降噪功能,开放设置接口:-setDenoiseLevel:; +3、优化视频播放器,降低音频播放的延迟性; + +1.3.2 //2019071601 +1、修复日志模块JMLogUtil接口:-setSavePathDic设置路径判断字符串错误的问题; +2、修复无网络的情况下连接服务器,之后有网之后无法成功连接的问题(Hosts IP未正常解析导致); +3、优化URL请求模块,使SDK在声明周期内一直保持与设备的心跳连接; + 1.3.0 //2019062501 1、新增SDK初始化接口:JimiVideoPlayer:+Initialize,其他接口调用之前必须先初始化SDK; 2、新增SDK释放接口:JimiVideoPlayer:+DeInitialize,在准备不再使用SDK时调用此接口; diff --git a/ios/RNJimiRTMPPlayer/JimiVideoPlayer.framework/Headers/JMVideoStreamPlayer.h b/ios/RNJimiRTMPPlayer/JimiVideoPlayer.framework/Headers/JMVideoStreamPlayer.h index c437a9e..bb9c7e6 100644 --- a/ios/RNJimiRTMPPlayer/JimiVideoPlayer.framework/Headers/JMVideoStreamPlayer.h +++ b/ios/RNJimiRTMPPlayer/JimiVideoPlayer.framework/Headers/JMVideoStreamPlayer.h @@ -270,6 +270,15 @@ typedef enum : NSUInteger { */ - (void)switchCamera:(BOOL)isFront autoPlay:(BOOL)bAuto handler:(JMSwitchCameraHandler _Nullable)handler; +/** + 切换分辨率(暂时无效) + + @param quality 视频质量(0:标清,1:高清) + @param bAuto 是否自动播放 + @param handler 切换之后的回调 + */ +- (void)switchResolution:(NSInteger)quality autoPlay:(BOOL)bAuto handler:(JMSwitchCameraHandler _Nullable)handler; + #pragma mark - 截图及视频录制 /** @@ -313,6 +322,13 @@ typedef enum : NSUInteger { */ - (long)getRecordingRuration; +/** + 是否开启音频降噪功能及级别 + + @param level 级别:0~3,0表示关闭,默认3 + */ +- (void)setDenoiseLevel:(int)level; + #pragma mark - 高级接口 /** diff --git a/ios/RNJimiRTMPPlayer/JimiVideoPlayer.framework/Info.plist b/ios/RNJimiRTMPPlayer/JimiVideoPlayer.framework/Info.plist index c0659e4..7355c71 100644 Binary files a/ios/RNJimiRTMPPlayer/JimiVideoPlayer.framework/Info.plist and b/ios/RNJimiRTMPPlayer/JimiVideoPlayer.framework/Info.plist differ diff --git a/ios/RNJimiRTMPPlayer/JimiVideoPlayer.framework/JimiVideoPlayer b/ios/RNJimiRTMPPlayer/JimiVideoPlayer.framework/JimiVideoPlayer index f197157..3f67947 100755 Binary files a/ios/RNJimiRTMPPlayer/JimiVideoPlayer.framework/JimiVideoPlayer and b/ios/RNJimiRTMPPlayer/JimiVideoPlayer.framework/JimiVideoPlayer differ diff --git a/ios/RNJimiRTMPPlayer/JimiVideoPlayer.framework/_CodeSignature/CodeResources b/ios/RNJimiRTMPPlayer/JimiVideoPlayer.framework/_CodeSignature/CodeResources new file mode 100644 index 0000000..7b9b776 --- /dev/null +++ b/ios/RNJimiRTMPPlayer/JimiVideoPlayer.framework/_CodeSignature/CodeResources @@ -0,0 +1,207 @@ + + + + + files + + ChangeLog + + T/eMlvQvExxJSU213lXQqFgS5ws= + + Headers/GLMonitor.h + + ZZ0LVcfwFRzOL8de0mUAwNhz7jk= + + Headers/JMLogController.h + + Onu7x83XwZwdIopg/I5DN6tntwU= + + Headers/JMVideoStreamPlayer.h + + gwIt8sykHcvrVyUhiGTxx69OKJ0= + + Headers/JimiVideoPlayer.h + + xj21BmMYjM6B3HhZmS6Rrs7Waqc= + + Headers/Monitor.h + + Wa0rniCDhBpnt6+KrcOhT0gEw44= + + Info.plist + + ChFk+ESWQfHzPkJPaQizS9QVQ7s= + + Modules/module.modulemap + + a4YlsEcTinyi/46pZIdMN3dhlFY= + + + files2 + + ChangeLog + + hash + + T/eMlvQvExxJSU213lXQqFgS5ws= + + hash2 + + eehdoqzd+xd/Xlir0H4E+aXAkwytBEkY8+s4OX+NIto= + + + Headers/GLMonitor.h + + hash + + ZZ0LVcfwFRzOL8de0mUAwNhz7jk= + + hash2 + + 5FUhZ+GPgx6I29wTUyj7gGcSV0kP8r6sj42DwtPxtVo= + + + Headers/JMLogController.h + + hash + + Onu7x83XwZwdIopg/I5DN6tntwU= + + hash2 + + hKa/Mvly3RRXPKF/XnDj472SIsPRUzhhABwLET2jHAw= + + + Headers/JMVideoStreamPlayer.h + + hash + + gwIt8sykHcvrVyUhiGTxx69OKJ0= + + hash2 + + PEkgPcw8EsA3D825z6Nj9m87/TFyFwhYPNTe9JrNnss= + + + Headers/JimiVideoPlayer.h + + hash + + xj21BmMYjM6B3HhZmS6Rrs7Waqc= + + hash2 + + SRawQD1qEyHHkzibZvUUMP4w91+q4MtAOAcinOFbuEk= + + + Headers/Monitor.h + + hash + + Wa0rniCDhBpnt6+KrcOhT0gEw44= + + hash2 + + VWDj1yAGHqPAJ2mvnmUbTzpyrkplASZuDnkKvtdFOK0= + + + Modules/module.modulemap + + hash + + a4YlsEcTinyi/46pZIdMN3dhlFY= + + hash2 + + 4S28kyX8rBUaEQAqSb1ey8nh04u74vNDaKyTSBTeia8= + + + + rules + + ^.* + + ^.*\.lproj/ + + optional + + weight + 1000 + + ^.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^Base\.lproj/ + + weight + 1010 + + ^version.plist$ + + + rules2 + + .*\.dSYM($|/) + + weight + 11 + + ^(.*/)?\.DS_Store$ + + omit + + weight + 2000 + + ^.* + + ^.*\.lproj/ + + optional + + weight + 1000 + + ^.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^Base\.lproj/ + + weight + 1010 + + ^Info\.plist$ + + omit + + weight + 20 + + ^PkgInfo$ + + omit + + weight + 20 + + ^embedded\.provisionprofile$ + + weight + 20 + + ^version\.plist$ + + weight + 20 + + + + diff --git a/js/JMRTMPMonitorView.js b/js/JMRTMPMonitorView.js index 0574297..7869c7d 100755 --- a/js/JMRTMPMonitorView.js +++ b/js/JMRTMPMonitorView.js @@ -27,7 +27,7 @@ export default class RNJMRTMPMonitorView extends Component { } return ; } } diff --git a/package.json b/package.json index 37ddc3c..9851a37 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-rtmp-player-jm", - "version": "0.0.1", + "version": "1.0.0", "description": "Jimi Video Player for RTMP SDK modules and view for React Native(Android & IOS), support react native 0.57+. ", "main": "index.js", "scripts": { diff --git a/react-native-rtmp-player-jm.podspec b/react-native-rtmp-player-jm.podspec index f400a44..e5c4855 100644 --- a/react-native-rtmp-player-jm.podspec +++ b/react-native-rtmp-player-jm.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "react-native-rtmp-player-jm" - s.version = "0.0.1" + s.version = "1.0.0" s.summary = "Jimi RTMP Video Player SDK for React Native" s.description = <<-DESC