From 9f4a3fb648d8d498c0ac714a4d537c848985c8d5 Mon Sep 17 00:00:00 2001 From: matrixbirds Date: Wed, 13 Feb 2019 14:27:49 +0800 Subject: [PATCH] add android rn support --- .../java/com/syan/agora/AgoraManager.java | 138 +- .../main/java/com/syan/agora/AgoraModule.java | 2301 +++++++++++++++-- .../java/com/syan/agora/ConvertUtils.java | 298 +++ .../syan/agora/ReactNativeAgoraException.java | 19 + .../main/jniLibs/arm64-v8a/libagora-crypto.so | 3 - .../jniLibs/arm64-v8a/libagora-rtc-sdk-jni.so | 3 - .../jniLibs/armeabi-v7a/libagora-crypto.so | 3 - .../armeabi-v7a/libagora-rtc-sdk-jni.so | 3 - .../main/jniLibs/include/IAgoraMediaEngine.h | 181 -- .../main/jniLibs/include/IAgoraRtcEngine.h | 2255 ---------------- .../src/main/jniLibs/x86/libagora-crypto.so | 3 - .../main/jniLibs/x86/libagora-rtc-sdk-jni.so | 3 - package-lock.json | 1249 ++++++--- 13 files changed, 3403 insertions(+), 3056 deletions(-) create mode 100644 android/src/main/java/com/syan/agora/ConvertUtils.java create mode 100644 android/src/main/java/com/syan/agora/ReactNativeAgoraException.java delete mode 100755 android/src/main/jniLibs/arm64-v8a/libagora-crypto.so delete mode 100755 android/src/main/jniLibs/arm64-v8a/libagora-rtc-sdk-jni.so delete mode 100755 android/src/main/jniLibs/armeabi-v7a/libagora-crypto.so delete mode 100755 android/src/main/jniLibs/armeabi-v7a/libagora-rtc-sdk-jni.so delete mode 100755 android/src/main/jniLibs/include/IAgoraMediaEngine.h delete mode 100755 android/src/main/jniLibs/include/IAgoraRtcEngine.h delete mode 100755 android/src/main/jniLibs/x86/libagora-crypto.so delete mode 100755 android/src/main/jniLibs/x86/libagora-rtc-sdk-jni.so diff --git a/android/src/main/java/com/syan/agora/AgoraManager.java b/android/src/main/java/com/syan/agora/AgoraManager.java index e0717e91c..20003686a 100755 --- a/android/src/main/java/com/syan/agora/AgoraManager.java +++ b/android/src/main/java/com/syan/agora/AgoraManager.java @@ -1,18 +1,25 @@ package com.syan.agora; import android.content.Context; +import android.support.v7.widget.LinearLayoutCompat; import android.util.Log; import android.util.SparseArray; import android.view.SurfaceView; import com.facebook.react.bridge.ReadableMap; +import com.facebook.react.bridge.WritableMap; import java.util.ArrayList; import java.util.List; +import java.util.Map; import io.agora.rtc.IRtcEngineEventHandler; import io.agora.rtc.RtcEngine; import io.agora.rtc.video.VideoCanvas; +import io.agora.rtc.video.VideoEncoderConfiguration; + +import static io.agora.rtc.video.VideoEncoderConfiguration.*; + /** * Created by Leon on 2017/4/9. @@ -45,31 +52,77 @@ public static AgoraManager getInstance() { return sAgoraManager; } + private FRAME_RATE getVideoEncoderEnum (int val) { + FRAME_RATE type = FRAME_RATE.FRAME_RATE_FPS_1; + switch (val) { + case 1: + type = FRAME_RATE.FRAME_RATE_FPS_1; + case 7: + type = FRAME_RATE.FRAME_RATE_FPS_7; + case 10: + type = FRAME_RATE.FRAME_RATE_FPS_10; + case 15: + type = FRAME_RATE.FRAME_RATE_FPS_15; + case 24: + type = FRAME_RATE.FRAME_RATE_FPS_24; + case 30: + type = FRAME_RATE.FRAME_RATE_FPS_30; + } + return type; + } + + private ORIENTATION_MODE getOrientationModeEnum (int val) { + ORIENTATION_MODE type = ORIENTATION_MODE.ORIENTATION_MODE_ADAPTIVE; + switch (val) { + case 0: + type = ORIENTATION_MODE.ORIENTATION_MODE_ADAPTIVE; + case 1: + type = ORIENTATION_MODE.ORIENTATION_MODE_FIXED_LANDSCAPE; + case 2: + type = ORIENTATION_MODE.ORIENTATION_MODE_FIXED_PORTRAIT; + } + return type; + } + /** - * 初始化RtcEngine + * initialize rtc engine */ - public void init(Context context, IRtcEngineEventHandler mRtcEventHandler, ReadableMap options) { + public int init(Context context, IRtcEngineEventHandler mRtcEventHandler, ReadableMap options) { this.context = context; - //创建RtcEngine对象,mRtcEventHandler为RtcEngine的回调 + //create rtcEngine instance and setup rtcEngine eventHandler try { mRtcEngine = RtcEngine.create(context, options.getString("appid"), mRtcEventHandler); - + if (null != options.getString("secret")) { + mRtcEngine.setEncryptionSecret(options.getString("secret")); + if (null != options.getString("secretMode")) { + mRtcEngine.setEncryptionMode(options.getString("secretMode")); + } + } } catch (Exception e) { - throw new RuntimeException("NEED TO check rtc sdk init fatal error\n" + Log.getStackTraceString(e)); + throw new RuntimeException("create rtc engine failed\n" + Log.getStackTraceString(e)); } - //开启视频功能 + mRtcEngine.enableDualStreamMode(true); + mRtcEngine.setChannelProfile(options.getInt("channelProfile")); mRtcEngine.enableVideo(); - mRtcEngine.setVideoProfile(options.getInt("videoProfile"), options.getBoolean("swapWidthAndHeight")); //视频配置, - mRtcEngine.enableWebSdkInteroperability(true); //设置和web通信 - mRtcEngine.setChannelProfile(options.getInt("channelProfile")); //设置模式 - mRtcEngine.setClientRole(options.getInt("clientRole"), null); //设置角色 + ReadableMap config = options.getMap("videoEncoderConfig"); + VideoEncoderConfiguration encoderConfig = new VideoEncoderConfiguration( + config.getInt("width"), + config.getInt("height"), + getVideoEncoderEnum(config.getInt("frameRate")), + config.getInt("bitrate"), + getOrientationModeEnum(config.getInt("orientationMode")) + ); + mRtcEngine.setVideoEncoderConfiguration(encoderConfig); + mRtcEngine.setAudioProfile(options.getInt("audioProfile"), options.getInt("audioScenario")); + mRtcEngine.setClientRole(options.getInt("clientRole")); + return mRtcEngine.enableWebSdkInteroperability(true); } /** * 设置本地视频,即前置摄像头预览 */ - public AgoraManager setupLocalVideo() { + public int setupLocalVideo() { //创建一个SurfaceView用作视频预览 SurfaceView surfaceView = RtcEngine.CreateRendererView(context); //将SurfaceView保存起来在SparseArray中,后续会将其加入界面。key为视频的用户id,这里是本地视频, 默认id是0 @@ -78,36 +131,61 @@ public AgoraManager setupLocalVideo() { //设置本地视频,渲染模式选择VideoCanvas.RENDER_MODE_HIDDEN,如果选其他模式会出现视频不会填充满整个SurfaceView的情况, //具体渲染模式参考官方文档https://docs.agora.io/cn/user_guide/API/android_api.html#set-local-video-view-setuplocalvideo - mRtcEngine.setupLocalVideo(new VideoCanvas(surfaceView, VideoCanvas.RENDER_MODE_HIDDEN, mLocalUid)); - return this;//返回AgoraManager以作链式调用 + return mRtcEngine.setupLocalVideo(new VideoCanvas(surfaceView, VideoCanvas.RENDER_MODE_HIDDEN, mLocalUid)); } - public AgoraManager setupRemoteVideo(int uid) { + public int setupRemoteVideo(int uid) { SurfaceView surfaceView = RtcEngine.CreateRendererView(context); mSurfaceViews.put(uid, surfaceView); - mRtcEngine.setupRemoteVideo(new VideoCanvas(surfaceView, VideoCanvas.RENDER_MODE_HIDDEN, uid)); - return this; + return mRtcEngine.setupRemoteVideo(new VideoCanvas(surfaceView, VideoCanvas.RENDER_MODE_HIDDEN, uid)); } - public AgoraManager joinChannel(String channel, int uid) { - mRtcEngine.joinChannel(null, channel, null, uid); - return this; + public int setEnableSpeakerphone(boolean enabled) { + return mRtcEngine.setEnableSpeakerphone(enabled); } - public AgoraManager joinChannelWithToken(String token, String channel, int uid) { - mRtcEngine.joinChannel(token, channel, null, uid); - return this; + public int setDefaultAudioRouteToSpeakerphone(boolean enabled) { + return mRtcEngine.setDefaultAudioRoutetoSpeakerphone(enabled); } - public AgoraManager enableLastmileTest() { - mRtcEngine.enableLastmileTest(); - return this; + public int renewToken(String token) { + return mRtcEngine.renewToken(token); + } + + public int setClientRole(int role) { + return mRtcEngine.setClientRole(role); + } + + public int enableWebSdkInteroperability(boolean enabled) { + return mRtcEngine.enableWebSdkInteroperability(enabled); + } + + public int getConnectionState() { + return mRtcEngine.getConnectionState(); + } + public int joinChannel(ReadableMap options) { + String token = options.getString("token"); + String channel = options.getString("channel"); + String optionalInfo = options.getString("optionalInfo"); + int uid = options.getInt("uid"); + return mRtcEngine.joinChannel(token, channel, optionalInfo, uid); + } + +// public int joinChannelWithToken(ReadableMap options) { +// String token = options.getString("token"); +// String channel = options.getString("channel"); +// String optionalInfo = options.getString("optionalInfo"); +// int uid = options.getInt("uid"); +// return mRtcEngine.joinChannel(token, channel, optionalInfo, uid); +// } + + public int enableLastmileTest() { + return mRtcEngine.enableLastmileTest(); } - public AgoraManager disableLastmileTest() { - mRtcEngine.disableLastmileTest(); - return this; + public int disableLastmileTest() { + return mRtcEngine.disableLastmileTest(); } public void startPreview() { @@ -118,8 +196,8 @@ public void stopPreview() { mRtcEngine.stopPreview(); } - public void leaveChannel() { - mRtcEngine.leaveChannel(); + public int leaveChannel() { + return mRtcEngine.leaveChannel(); } public void removeSurfaceView(int uid) { diff --git a/android/src/main/java/com/syan/agora/AgoraModule.java b/android/src/main/java/com/syan/agora/AgoraModule.java index 6bd877c23..2c0ac54a3 100644 --- a/android/src/main/java/com/syan/agora/AgoraModule.java +++ b/android/src/main/java/com/syan/agora/AgoraModule.java @@ -1,29 +1,151 @@ package com.syan.agora; +import android.graphics.Rect; +import android.net.wifi.p2p.nsd.WifiP2pServiceRequest; import android.support.annotation.Nullable; +import android.support.v7.widget.LinearLayoutCompat; +import android.telecom.Call; import android.util.Log; import com.facebook.react.bridge.Arguments; import com.facebook.react.bridge.Callback; +import com.facebook.react.bridge.Promise; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.ReactContext; import com.facebook.react.bridge.ReactContextBaseJavaModule; import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.ReadableArray; import com.facebook.react.bridge.ReadableMap; import com.facebook.react.bridge.WritableArray; import com.facebook.react.bridge.WritableMap; import com.facebook.react.modules.core.DeviceEventManagerModule; +import com.google.gson.Gson; + +import java.lang.reflect.Array; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.RegEx; + +import io.agora.rtc.IAudioEffectManager; import io.agora.rtc.IRtcEngineEventHandler; import io.agora.rtc.PublisherConfiguration; import io.agora.rtc.RtcEngine; +import io.agora.rtc.live.LiveInjectStreamConfig; +import io.agora.rtc.live.LiveInjectStreamConfig.AudioSampleRateType; +import io.agora.rtc.live.LiveTranscoding; +import io.agora.rtc.video.AgoraImage; import static com.facebook.react.bridge.UiThreadUtil.runOnUiThread; +import static io.agora.rtc.Constants.*; public class AgoraModule extends ReactContextBaseJavaModule { - public AgoraModule(ReactApplicationContext context) { + private static String FPS1 = "FPS1"; + private static String FPS7 = "FPS7"; + private static String FPS10 = "FPS10"; + private static String FPS15 = "FPS15"; + private static String FPS24 = "FPS24"; + private static String FPS30 = "FPS30"; + private static String FPS60 = "FPS60"; + private static String Adaptative = "Adaptative"; + private static String FixedLandscape = "FixedLandscape"; + private static String FixedPortrait = "FixedPortrait"; + private static String Host = "Host"; + private static String Audience = "Audience"; + private static String UserOfflineReasonQuit = "UserOfflineReasonQuit"; + private static String UserOfflineReasonDropped = "UserOfflineReasonDropped"; + private static String UserOfflineReasonBecomeAudience = "UserOfflineReasonBecomeAudience"; + private static String CodecTypeBaseLine = "CodecTypeBaseLine"; + private static String CodecTypeMain = "CodecTypeMain"; + private static String CodecTypeHigh = "CodecTypeHigh"; + private static String AudioSampleRateType32000 = "AudioSampleRateType32000"; + private static String AudioSampleRateType44100 = "AudioSampleRateType44100"; + private static String AudioSampleRateType48000 = "AudioSampleRateType48000"; + private static String QualityLow = "QualityLow"; + private static String QualityMedium = "QualityMedium"; + private static String QualityHigh = "QualityHigh"; + private static String Disconnected = "Disconnected"; + private static String Connecting = "Connecting"; + private static String Connected = "Connected"; + private static String Reconnecting = "Reconnecting"; + private static String ConnectionFailed = "ConnectionFailed"; + private static String ConnectionChangedConnecting = "ConnectionChangedConnecting"; + private static String ConnectionChangedJoinSuccess = "ConnectionChangedJoinSuccess"; + private static String ConnectionChangedInterrupted = "ConnectionChangedInterrupted"; + private static String ConnectionChangedBannedByServer = "ConnectionChangedBannedByServer"; + private static String ConnectionChangedJoinFailed = "ConnectionChangedJoinFailed"; + private static String ConnectionChangedLeaveChannel = "ConnectionChangedLeaveChannel"; + private static String AudioOutputRoutingDefault = "AudioOutputRoutingDefault"; + private static String AudioOutputRoutingHeadset = "AudioOutputRoutingHeadset"; + private static String AudioOutputRoutingEarpiece = "AudioOutputRoutingEarpiece"; + private static String AudioOutputRoutingHeadsetNoMic = "AudioOutputRoutingHeadsetNoMic"; + private static String AudioOutputRoutingSpeakerphone = "AudioOutputRoutingSpeakerphone"; + private static String AudioOutputRoutingLoudspeaker = "AudioOutputRoutingLoudspeaker"; + private static String AudioOutputRoutingHeadsetBluetooth = "AudioOutputRoutingHeadsetBluetooth"; + private static String NetworkQualityUnknown = "NetworkQualityUnknown"; + private static String NetworkQualityExcellent = "NetworkQualityExcellent"; + private static String NetworkQualityGood = "NetworkQualityGood"; + private static String NetworkQualityPoor = "NetworkQualityPoor"; + private static String NetworkQualityBad = "NetworkQualityBad"; + private static String NetworkQualityVBad = "NetworkQualityVBad"; + private static String NetworkQualityDown = "NetworkQualityDown"; + private static String AudioProfileDefault = "AudioProfileDefault"; + private static String AudioProfileSpeechStandard = "AudioProfileSpeechStandard"; + private static String AudioProfileMusicStandard = "AudioProfileMusicStandard"; + private static String AgoraAudioProfileMusicStandardStereo = "AudioProfileMusicStandardStereo"; + private static String AudioProfileMusicHighQuality = "AudioProfileMusicHighQuality"; + private static String AudioProfileMusicHighQualityStereo = "AudioProfileMusicHighQualityStereo"; + private static String AudioScenarioDefault = "AudioScenarioDefault"; + private static String AudioScenarioChatRoomEntertainment = "AudioScenarioChatRoomEntertainment"; + private static String AudioScenarioEducation = "AudioScenarioEducation"; + private static String AudioScenarioGameStreaming = "AudioScenarioGameStreaming"; + private static String AudioScenarioShowRoom = "AudioScenarioShowRoom"; + private static String AudioScenarioChatRoomGaming = "AudioScenarioChatRoomGaming"; + private static String AudioEqualizationBand31 = "AudioEqualizationBand31"; + private static String AudioEqualizationBand62 = "AudioEqualizationBand62"; + private static String AudioEqualizationBand125 = "AudioEqualizationBand125"; + private static String AudioEqualizationBand250 = "AudioEqualizationBand250"; + private static String AudioEqualizationBand500 = "AudioEqualizationBand500"; + private static String AudioEqualizationBand1K = "AudioEqualizationBand1K"; + private static String AudioEqualizationBand2K = "AudioEqualizationBand2K"; + private static String AudioEqualizationBand4K = "AudioEqualizationBand4K"; + private static String AudioEqualizationBand8K = "AudioEqualizationBand8K"; + private static String AudioEqualizationBand16K = "AudioEqualizationBand16K"; + private static String AudioRawFrameOperationModeReadOnly = "AudioRawFrameOperationModeReadOnly"; + private static String AudioRawFrameOperationModeWriteOnly = "AudioRawFrameOperationModeWriteOnly"; + private static String AudioRawFrameOperationModeReadWrite = "AudioRawFrameOperationModeReadWrite"; + private static String VideoStreamTypeHigh = "VideoStreamTypeHigh"; + private static String VideoStreamTypeLow = "VideoStreamTypeLow"; + private static String VideoMirrorModeAuto = "VideoMirrorModeAuto"; + private static String VideoMirrorModeEnabled = "VideoMirrorModeEnabled"; + private static String VideoMirrorModeDisabled = "VideoMirrorModeDisabled"; + private static String ChannelProfileCommunication = "ChannelProfileCommunication"; + private static String ChannelProfileLiveBroadcasting = "ChannelProfileLiveBroadcasting"; + private static String ChannelProfileGame = "ChannelProfileGame"; + private static String ErrorCodeNoError = "ErrorCodeNoError"; + private static String ErrorCodeFailed = "ErrorCodeFailed"; + private static String ErrorCodeInvalidArgument = "ErrorCodeInvalidArgument"; + private static String ErrorCodeTimedOut = "ErrorCodeTimedOut"; + private static String ErrorCodeAlreadyInUse = "ErrorCodeAlreadyInUse"; +// private static String ErrorCodeAbort = "ErrorCodeAbort"; + private static String ErrorCodeEncryptedStreamNotAllowedPublished = "ErrorCodeEncryptedStreamNotAllowedPublished"; +// private static String ErrorCodeResourceLimited = "ErrorCodeResourceLimited"; + private static String InjectStreamStatusStartSuccess = "InjectStreamStatusStartSuccess"; + private static String InjectStreamStatusStartAlreadyExist = "InjectStreamStatusStartAlreadyExist"; + private static String InjectStreamStatusStartUnauthorized = "InjectStreamStatusStartUnauthorized"; + private static String InjectStreamStatusStartTimeout = "InjectStreamStatusStartTimeout"; + private static String InjectStreamStatusStartFailed = "InjectStreamStatusStartFailed"; + private static String InjectStreamStatusStopSuccess = "InjectStreamStatusStopSuccess"; + private static String InjectStreamStatusStopNotFound = "InjectStreamStatusStopNotFound"; + private static String InjectStreamStatusStopUnauthorized = "InjectStreamStatusStopUnauthorized"; + private static String InjectStreamStatusStopTimeout = "InjectStreamStatusStopTimeout"; + private static String InjectStreamStatusStopFailed = "InjectStreamStatusStopFailed"; + private static String InjectStreamStatusBroken = "InjectStreamStatusBroken"; + public AgoraModule(ReactApplicationContext context) { super(context); } @@ -32,107 +154,265 @@ public String getName() { return "RCTAgora"; } + @Override + public Map getConstants() { + final Map constants = new HashMap<>(); + + constants.put(ChannelProfileCommunication, CHANNEL_PROFILE_LIVE_BROADCASTING); + constants.put(ChannelProfileLiveBroadcasting, CHANNEL_PROFILE_LIVE_BROADCASTING); + constants.put(ChannelProfileGame, CHANNEL_PROFILE_GAME); + constants.put(UserOfflineReasonQuit, USER_OFFLINE_QUIT); + constants.put(UserOfflineReasonDropped, USER_OFFLINE_DROPPED); + constants.put(UserOfflineReasonBecomeAudience, USER_OFFLINE_BECOME_AUDIENCE); + constants.put(Disconnected, CONNECTION_STATE_DISCONNECTED); + constants.put(Connecting, CONNECTION_STATE_CONNECTING); + constants.put(Connected, CONNECTION_STATE_CONNECTED); + constants.put(Reconnecting, CONNECTION_STATE_RECONNECTING); + constants.put(ConnectionFailed, CONNECTION_STATE_FAILED); + constants.put(ConnectionChangedConnecting, CONNECTION_CHANGED_CONNECTING); + constants.put(ConnectionChangedJoinSuccess, CONNECTION_CHANGED_JOIN_SUCCESS); + constants.put(ConnectionChangedInterrupted, CONNECTION_CHANGED_INTERRUPTED); + constants.put(ConnectionChangedBannedByServer, CONNECTION_CHANGED_BANNED_BY_SERVER); + constants.put(ConnectionChangedJoinFailed, CONNECTION_CHANGED_JOIN_FAILED); + constants.put(ConnectionChangedLeaveChannel, CONNECTION_CHANGED_LEAVE_CHANNEL); + constants.put(AudioOutputRoutingDefault, AUDIO_ROUTE_DEFAULT); + constants.put(AudioOutputRoutingHeadset, AUDIO_ROUTE_HEADSET); + constants.put(AudioOutputRoutingEarpiece, AUDIO_ROUTE_EARPIECE); + constants.put(AudioOutputRoutingHeadsetNoMic, AUDIO_ROUTE_HEADSETNOMIC); + constants.put(AudioOutputRoutingSpeakerphone, AUDIO_ROUTE_SPEAKERPHONE); + constants.put(AudioOutputRoutingLoudspeaker, AUDIO_ROUTE_LOUDSPEAKER); + constants.put(AudioOutputRoutingHeadsetBluetooth, AUDIO_ROUTE_HEADSETBLUETOOTH); + constants.put(NetworkQualityUnknown, QUALITY_UNKNOWN); + constants.put(NetworkQualityExcellent, QUALITY_EXCELLENT); + constants.put(NetworkQualityGood, QUALITY_GOOD); + constants.put(NetworkQualityPoor, QUALITY_POOR); + constants.put(NetworkQualityBad, QUALITY_BAD); + constants.put(NetworkQualityVBad, QUALITY_VBAD); + constants.put(NetworkQualityDown, QUALITY_DOWN); + constants.put(ErrorCodeNoError, ERR_OK); + constants.put(ErrorCodeFailed, ERR_FAILED); + constants.put(ErrorCodeInvalidArgument, ERR_INVALID_ARGUMENT); + constants.put(ErrorCodeTimedOut, ERR_TIMEDOUT); + constants.put(ErrorCodeAlreadyInUse, ERR_ALREADY_IN_USE); + constants.put(ErrorCodeEncryptedStreamNotAllowedPublished, ERR_ENCRYPTED_STREAM_NOT_ALLOWED_PUBLISHED); + constants.put(InjectStreamStatusStartSuccess, INJECT_STREAM_STATUS_START_SUCCESS); + constants.put(InjectStreamStatusStartAlreadyExist, INJECT_STREAM_STATUS_START_ALREADY_EXISTS); + constants.put(InjectStreamStatusStartUnauthorized, INJECT_STREAM_STATUS_START_UNAUTHORIZED); + constants.put(InjectStreamStatusStartTimeout, INJECT_STREAM_STATUS_START_TIMEDOUT); + constants.put(InjectStreamStatusStartFailed, INJECT_STREAM_STATUS_START_FAILED); + constants.put(InjectStreamStatusStopSuccess, INJECT_STREAM_STATUS_STOP_SUCCESS); + constants.put(InjectStreamStatusStopNotFound, INJECT_STREAM_STATUS_STOP_NOT_FOUND); + constants.put(InjectStreamStatusStopUnauthorized, INJECT_STREAM_STATUS_STOP_UNAUTHORIZED); + constants.put(InjectStreamStatusStopTimeout, INJECT_STREAM_STATUS_STOP_TIMEDOUT); + constants.put(InjectStreamStatusStopFailed, INJECT_STREAM_STATUS_STOP_FAILED); + constants.put(InjectStreamStatusBroken, INJECT_STREAM_STATUS_BROKEN); + constants.put(AudioSampleRateType32000, 32000); + constants.put(AudioSampleRateType44100, 44100); + constants.put(AudioSampleRateType48000, 48000); + return constants; + } + private IRtcEngineEventHandler mRtcEventHandler = new IRtcEngineEventHandler() { - /** - * 当获取用户uid的远程视频的回调 - */ @Override - public void onFirstRemoteVideoDecoded(final int uid, int width, int height, int elapsed) { + public void onWarning(final int code) { runOnUiThread(new Runnable() { @Override public void run() { WritableMap map = Arguments.createMap(); - map.putString("type", "onFirstRemoteVideoDecoded"); - map.putInt("uid", uid); - commonEvent(map); + map.putString("message", "AgoraWarning"); + map.putInt("code", code); } }); - } - /** - * 加入频道成功的回调 - */ @Override - public void onJoinChannelSuccess(final String channel, final int uid, int elapsed) { + public void onError(final int code) { + runOnUiThread(new Runnable() { + @Override + public void run() { + WritableMap map = Arguments.createMap(); + map.putString("message", "AgoraError"); + map.putInt("code", code); + sendEvent(getReactApplicationContext(), "onError", map); + } + }); + } - Log.i("Agora", "加入房间成功---"); + @Override + public void onJoinChannelSuccess(final String channel, final int uid, final int elapsed) { + runOnUiThread(new Runnable() { + @Override + public void run() { + WritableMap map = Arguments.createMap(); + map.putString("channel", channel); + map.putInt("uid", uid); + map.putInt("elapsed", elapsed); + sendEvent(getReactApplicationContext(), "onJoinChannelSuccess", map); + } + }); + } + @Override + public void onRejoinChannelSuccess(final String channel, final int uid, final int elapsed) { runOnUiThread(new Runnable() { @Override public void run() { WritableMap map = Arguments.createMap(); - map.putString("type", "onJoinChannelSuccess"); map.putString("channel", channel); map.putInt("uid", uid); - commonEvent(map); + map.putInt("elapsed", elapsed); + sendEvent(getReactApplicationContext(), "onReJoinChannelSuccess", map); } + }); + } + + @Override + public void onLeaveChannel(final RtcStats stats) { + runOnUiThread(new Runnable() { + @Override + public void run() { + WritableMap statsMap = Arguments.createMap(); + statsMap.putInt("totalDuration", stats.totalDuration); + statsMap.putInt("txBytes", stats.txBytes); + statsMap.putInt("rxBytes", stats.rxBytes); + statsMap.putInt("txKBitRate", stats.txKBitRate); + statsMap.putInt("rxKBitRate", stats.rxKBitRate); + statsMap.putInt("txAudioKBitRate", stats.txAudioKBitRate); + statsMap.putInt("rxAudioKBitRate", stats.rxAudioKBitRate); + statsMap.putInt("txVideoKBitRate", stats.txVideoKBitRate); + statsMap.putInt("rxVideoKBitRate", stats.rxVideoKBitRate); + statsMap.putInt("users", stats.users); + statsMap.putInt("lastmileDelay", stats.lastmileDelay); + statsMap.putDouble("cpuTotalUsage", stats.cpuTotalUsage); + statsMap.putDouble("cpuAppUsage", stats.cpuAppUsage); + + WritableMap map = Arguments.createMap(); + map.putMap("stats", statsMap); + sendEvent(getReactApplicationContext(), "onLeaveChannel", map); } }); } - /** - * 其他用户加入当前频道 - */ @Override - public void onUserJoined(final int uid, int elapsed) { + public void onClientRoleChanged(final int oldRole, final int newRole) { + runOnUiThread(new Runnable() { + @Override + public void run() { + WritableMap map = Arguments.createMap(); + map.putInt("oldRole", oldRole); + map.putInt("newRole", newRole); + sendEvent(getReactApplicationContext(), "onClientRoleChanged", map); + } + }); + } - Log.i("Agora", "有人来了----"); + @Override + public void onUserJoined(final int uid, final int elapsed) { + runOnUiThread(new Runnable() { + @Override + public void run() { + WritableMap map = Arguments.createMap(); + map.putInt("uid", uid); + map.putInt("elapsed", elapsed); + sendEvent(getReactApplicationContext(), "onUserJoined", map); + } + }); + } + @Override + public void onUserOffline(final int uid, final int reason) { runOnUiThread(new Runnable() { @Override public void run() { WritableMap map = Arguments.createMap(); - map.putString("type", "onUserJoined"); map.putInt("uid", uid); - commonEvent(map); + map.putInt("reason", reason); + sendEvent(getReactApplicationContext(), "onUserOffline", map); + } + }); + } + + @Override + public void onConnectionStateChanged(final int state, final int reason) { + runOnUiThread(new Runnable() { + @Override + public void run() { + WritableMap map = Arguments.createMap(); + map.putInt("state", state); + map.putInt("reason", reason); + sendEvent(getReactApplicationContext(), "onConnectionStateChanged", map); + } + }); + } + + + @Override + public void onConnectionLost() { + runOnUiThread(new Runnable() { + @Override + public void run() { + WritableMap map = Arguments.createMap(); + map.putString("message", "onConnectionLost"); + sendEvent(getReactApplicationContext(), "onConnectionLost", map); } }); + } + @Override + public void onApiCallExecuted(final int code, final String api, final String result) { + runOnUiThread(new Runnable() { + @Override + public void run() { + if (code != 0) { + WritableMap map = Arguments.createMap(); + map.putInt("error", code); + map.putString("api", api); + map.putString("result", result); + sendEvent(getReactApplicationContext(), "onApiCallExecuted", map); + } + } + }); } - // 接收到对方数据流消息的回调 @Override - public void onStreamMessage(final int uid, final int streamId, final byte[] data) { + public void onTokenPrivilegeWillExpire(final String token) { runOnUiThread(new Runnable() { @Override public void run() { - String msg = new String(data); WritableMap map = Arguments.createMap(); - map.putString("type", "onStreamMessage"); - map.putInt("uid", uid); - map.putInt("streamId", streamId); - map.putString("data", msg); - commonEvent(map); + map.putString("token", token); + sendEvent(getReactApplicationContext(), "onTokenPrivilegeWillExpire", map); } }); } - // 接收对方数据流消息错误的回调 @Override - public void onStreamMessageError(final int uid, final int streamId, final int code, final int missed, final int cached) { + public void onRequestToken() { runOnUiThread(new Runnable() { @Override public void run() { WritableMap map = Arguments.createMap(); - map.putString("type", "onStreamMessageError"); - map.putInt("uid", uid); - map.putInt("streamId", streamId); - map.putInt("error", code); - map.putInt("missed", missed); - map.putInt("cached", cached); - commonEvent(map); + map.putString("message", "RequestToken"); + sendEvent(getReactApplicationContext(), "onRequestToken", map); } }); } - /** - * 说话声音音量提示回调 - */ @Override - public void onAudioVolumeIndication(final AudioVolumeInfo[] speakers, - final int totalVolume) { + public void onMicrophoneEnabled(final boolean enabled) { + runOnUiThread(new Runnable() { + @Override + public void run() { + WritableMap map = Arguments.createMap(); + map.putBoolean("enabled", enabled); + sendEvent(getReactApplicationContext(), "onMicrophoneEnabled", map); + } + + }); + } + @Override + public void onAudioVolumeIndication(final AudioVolumeInfo [] speakers, final int totalVolume) { runOnUiThread(new Runnable() { @Override public void run() { @@ -146,388 +426,1963 @@ public void run() { } WritableMap map = Arguments.createMap(); - map.putString("type", "onAudioVolumeIndication"); map.putArray("speakers", arr); map.putInt("totalVolume", totalVolume); - commonEvent(map); + sendEvent(getReactApplicationContext(), "onAudioVolumeIndication", map); } }); } - /** - * 错误信息 - */ @Override - public void onError(final int err) { - Log.i("Agora", err + "错误---"); + public void onActiveSpeaker(final int uid) { runOnUiThread(new Runnable() { @Override public void run() { WritableMap map = Arguments.createMap(); - map.putString("type", "onError"); - map.putInt("err", err); - commonEvent(map); + map.putInt("uid", uid); + sendEvent(getReactApplicationContext(), "onActiveSpeaker", map); } }); } - /** - * 警告 - */ @Override - public void onWarning(final int warn) { - Log.i("Agora", warn + "警告---"); + public void onFirstLocalAudioFrame(final int elapsed) { runOnUiThread(new Runnable() { @Override public void run() { WritableMap map = Arguments.createMap(); - map.putString("type", "onWarning"); - map.putInt("warn", warn); - commonEvent(map); + map.putInt("elapsed", elapsed); + sendEvent(getReactApplicationContext(), "onFirstLocalAudioFrame", map); + } + }); + } + + @Override + public void onFirstRemoteAudioFrame(final int uid, final int elapsed) { + runOnUiThread(new Runnable() { + @Override + public void run() { + WritableMap map = Arguments.createMap(); + map.putInt("uid", uid); + map.putInt("elapsed", elapsed); + sendEvent(getReactApplicationContext(), "onFirstRemoteAudioFrame", map); + } + }); + } + + @Override + public void onVideoStopped() { + runOnUiThread(new Runnable() { + @Override + public void run() { + WritableMap map = Arguments.createMap(); + map.putString("message", "VideoStopped"); + sendEvent(getReactApplicationContext(), "onVideoStopped", map); } }); } - /** - * 退出频道 - */ @Override - public void onLeaveChannel(RtcStats stats) { + public void onFirstLocalVideoFrame(final int width, final int height, final int elapsed) { runOnUiThread(new Runnable() { @Override public void run() { WritableMap map = Arguments.createMap(); - map.putString("type", "onLeaveChannel"); - commonEvent(map); + map.putInt("width", width); + map.putInt("height", height); + map.putInt("elapsed", elapsed); + sendEvent(getReactApplicationContext(), "onFirstLocalVideoFrame", map); } }); } /** - * 用户uid离线时的回调 + * onFirstRemoteVideoDecoded */ @Override - public void onUserOffline(final int uid, final int reason) { + public void onFirstRemoteVideoDecoded(final int uid, final int width, final int height, final int elapsed) { runOnUiThread(new Runnable() { @Override public void run() { WritableMap map = Arguments.createMap(); - map.putString("type", "onUserOffline"); map.putInt("uid", uid); - map.putInt("reason", reason); - commonEvent(map); + map.putInt("width", width); + map.putInt("height", height); + map.putInt("elapsed", elapsed); + sendEvent(getReactApplicationContext(), "onFirstRemoteVideoDecoded", map); + } + }); + } + + @Override + public void onFirstRemoteVideoFrame(final int uid, final int width, final int height, final int elapsed) { + runOnUiThread(new Runnable() { + @Override + public void run() { + WritableMap map = Arguments.createMap(); + map.putInt("uid", uid); + map.putInt("width", width); + map.putInt("height", height); + map.putInt("elapsed", elapsed); + sendEvent(getReactApplicationContext(), "onFirstRemoteVideoFrame", map); } }); } - /** - * 用户mute音频回调 - */ @Override public void onUserMuteAudio(final int uid, final boolean muted) { runOnUiThread(new Runnable() { @Override public void run() { WritableMap map = Arguments.createMap(); - map.putString("type", "onUserMuteAudio"); map.putInt("uid", uid); map.putBoolean("muted", muted); - commonEvent(map); + sendEvent(getReactApplicationContext(), "onUserMuteAudio", map); } }); } - /** - * 用户mute视频回调 - */ @Override public void onUserMuteVideo(final int uid, final boolean muted) { runOnUiThread(new Runnable() { @Override public void run() { WritableMap map = Arguments.createMap(); - map.putString("type", "onUserMuteVideo"); map.putInt("uid", uid); map.putBoolean("muted", muted); - commonEvent(map); + sendEvent(getReactApplicationContext(), "onUserMuteVideo", map); } }); } @Override - public void onLocalVideoStats(final LocalVideoStats stats) { + public void onUserEnableVideo(final int uid, final boolean muted) { runOnUiThread(new Runnable() { @Override public void run() { WritableMap map = Arguments.createMap(); - map.putString("type", "onLocalVideoStats"); - map.putInt("sentBitrate", stats.sentBitrate); - map.putInt("sentFrameRate", stats.sentFrameRate); - commonEvent(map); + map.putInt("uid", uid); + map.putBoolean("muted", muted); + sendEvent(getReactApplicationContext(), "onUserEnableVideo", map); } }); } @Override - public void onRemoteVideoStats(final RemoteVideoStats stats) { + public void onUserEnableLocalVideo(final int uid, final boolean muted) { runOnUiThread(new Runnable() { @Override public void run() { WritableMap map = Arguments.createMap(); - map.putString("type", "onRemoteVideoStats"); - map.putInt("delay", stats.delay); - map.putInt("receivedBitrate", stats.receivedBitrate); - map.putInt("receivedFrameRate", stats.receivedFrameRate); - map.putInt("rxStreamType", stats.rxStreamType); - commonEvent(map); + map.putInt("uid", uid); + map.putBoolean("muted", muted); + sendEvent(getReactApplicationContext(), "onUserEnableLocalVideo", map); } }); } @Override - public void onConnectionLost() { + public void onVideoSizeChanged(final int uid, final int width, final int height, final int rotation) { runOnUiThread(new Runnable() { @Override public void run() { WritableMap map = Arguments.createMap(); - map.putString("type", "onConnectionLost"); - commonEvent(map); + map.putInt("uid", uid); + map.putInt("width", width); + map.putInt("height", height); + map.putInt("rotation", rotation); + sendEvent(getReactApplicationContext(), "onVideoSizeChanged", map); } }); } @Override - public void onNetworkQuality(final int uid, final int txQuality, final int rxQuality) { + public void onRemoteVideoStateChanged(final int uid, final int state) { runOnUiThread(new Runnable() { @Override public void run() { WritableMap map = Arguments.createMap(); - map.putString("type", "onNetworkQuality"); map.putInt("uid", uid); - map.putInt("txQuality", txQuality); - map.putInt("rxQuality", rxQuality); - commonEvent(map); + map.putInt("state", state); + sendEvent(getReactApplicationContext(), "onRemoteVideoStateChanged", map); } }); } @Override - public void onLastmileQuality(final int quality) { + public void onLocalPublishFallbackToAudioOnly(final boolean isFallbackOrRecover) { runOnUiThread(new Runnable() { @Override public void run() { WritableMap map = Arguments.createMap(); - map.putString("type", "onLastmileQuality"); - map.putInt("quality", quality); - commonEvent(map); + map.putBoolean("isFallbackOrRecover", isFallbackOrRecover); + sendEvent(getReactApplicationContext(), "onLocalPublishFallbackToAudioOnly", map); } }); } - }; - @ReactMethod - public void init(ReadableMap options) { - AgoraManager.getInstance().init(getReactApplicationContext(), mRtcEventHandler, options); - } + @Override + public void onRemoteSubscribeFallbackToAudioOnly(final int uid, final boolean isFallbackOrRecover) { + runOnUiThread(new Runnable() { + @Override + public void run() { + WritableMap map = Arguments.createMap(); + map.putInt("uid", uid); + map.putBoolean("isFallbackOrRecover", isFallbackOrRecover); + sendEvent(getReactApplicationContext(), "onRemoteSubscribeFallbackToAudioOnly", map); + } + }); + } - @ReactMethod - public void enableLastmileTest() { - AgoraManager.getInstance().enableLastmileTest(); - } + @Override + public void onAudioRouteChanged(final int routing) { + runOnUiThread(new Runnable() { + @Override + public void run() { + WritableMap map = Arguments.createMap(); + map.putInt("routing", routing); + sendEvent(getReactApplicationContext(), "onAudioRouteChanged", map); + } + }); + } - @ReactMethod - public void disableLastmileTest() { - AgoraManager.getInstance().disableLastmileTest(); - } + @Override + public void onCameraReady() { + runOnUiThread(new Runnable() { + @Override + public void run() { + WritableMap map = Arguments.createMap(); + map.putString("message", "CameraDidReady"); + sendEvent(getReactApplicationContext(), "onCameraReady", map); + } + }); + } - //进入房间 - @ReactMethod - public void joinChannel(String channelName, int uid) { - AgoraManager.getInstance().joinChannel(channelName, uid); - } + @Override + public void onCameraFocusAreaChanged(final Rect rect) { + runOnUiThread(new Runnable() { + @Override + public void run() { + WritableMap rectMap = Arguments.createMap(); + rectMap.putInt("top", rect.top); + rectMap.putInt("right", rect.right); + rectMap.putInt("bottom", rect.bottom); + rectMap.putInt("left", rect.left); + WritableMap map = Arguments.createMap(); + map.putMap("rect", rectMap); + sendEvent(getReactApplicationContext(), "onCameraFocusAreaChanged", map); + } + }); + } - @ReactMethod - public void joinChannelWithToken(String token, String channelName, int uid) { - AgoraManager.getInstance().joinChannelWithToken(token, channelName, uid); - } + @Override + public void onCameraExposureAreaChanged(final Rect rect) { + runOnUiThread(new Runnable() { + @Override + public void run() { + WritableMap rectMap = Arguments.createMap(); + rectMap.putInt("top", rect.top); + rectMap.putInt("right", rect.right); + rectMap.putInt("bottom", rect.bottom); + rectMap.putInt("left", rect.left); + WritableMap map = Arguments.createMap(); + map.putMap("rect", rectMap); + sendEvent(getReactApplicationContext(), "onCameraExposureAreaChanged", map); + } + }); + } - //退出 - @ReactMethod - public void leaveChannel() { - AgoraManager.getInstance().stopPreview(); - AgoraManager.getInstance().leaveChannel(); - } + @Override + public void onRtcStats(final RtcStats stats) { + runOnUiThread(new Runnable() { + @Override + public void run() { + WritableMap statsMap = Arguments.createMap(); + statsMap.putInt("totalDuration", stats.totalDuration); + statsMap.putInt("txBytes", stats.txBytes); + statsMap.putInt("rxBytes", stats.rxBytes); + statsMap.putInt("txKBitRate", stats.txKBitRate); + statsMap.putInt("rxKBitRate", stats.rxKBitRate); + statsMap.putInt("txAudioKBitRate", stats.txAudioKBitRate); + statsMap.putInt("rxAudioKBitRate", stats.rxAudioKBitRate); + statsMap.putInt("txVideoKBitRate", stats.txVideoKBitRate); + statsMap.putInt("rxVideoKBitRate", stats.rxVideoKBitRate); + statsMap.putInt("users", stats.users); + statsMap.putInt("lastmileDelay", stats.lastmileDelay); + statsMap.putDouble("cpuTotalUsage", stats.cpuTotalUsage); + statsMap.putDouble("cpuAppUsage", stats.cpuAppUsage); - //开启预览 - @ReactMethod - public void startPreview() { - AgoraManager.getInstance().startPreview(); - } + WritableMap map = Arguments.createMap(); + map.putMap("stats", statsMap); + sendEvent(getReactApplicationContext(), "onRtcStats", map); + } + }); + } - //闭关预览 - @ReactMethod - public void stopPreview() { - AgoraManager.getInstance().stopPreview(); - } + @Override + public void onLastmileQuality(final int quality) { + runOnUiThread(new Runnable() { + @Override + public void run() { + WritableMap map = Arguments.createMap(); + map.putInt("quality", quality); + sendEvent(getReactApplicationContext(), "onLastmileQuality", map); + } + }); + } - //配置旁路直播推流 - @ReactMethod - public void configPublisher(ReadableMap options) { - PublisherConfiguration config = new PublisherConfiguration.Builder() - .owner(options.getBoolean("owner")) - .size(options.getInt("width"), options.getInt("height")) - .frameRate(options.getInt("framerate")) -// .biteRate(options.getInt("bitrate")) - .defaultLayout(options.getInt("defaultLayout")) - .streamLifeCycle(options.getInt("lifeCycle")) - .rawStreamUrl(options.getString("rawStreamUrl")) - .publishUrl(options.getString("publishUrl")) - .extraInfo(options.getString("extraInfo")) - .build(); + @Override + public void onNetworkQuality(final int uid, final int txQuality, final int rxQuality) { + runOnUiThread(new Runnable() { + @Override + public void run() { + WritableMap map = Arguments.createMap(); + map.putInt("uid", uid); + map.putInt("txQuality", txQuality); + map.putInt("rxQuality", rxQuality); + sendEvent(getReactApplicationContext(), "onNetworkQuality", map); + } + }); + } - AgoraManager.getInstance().mRtcEngine.configPublisher(config); + + @Override + public void onLocalVideoStats(final LocalVideoStats stats) { + runOnUiThread(new Runnable() { + @Override + public void run() { + WritableMap statsMap = Arguments.createMap(); + statsMap.putInt("sentBitrate", stats.sentBitrate); + statsMap.putInt("sentFrameRate", stats.sentFrameRate); + + WritableMap map = Arguments.createMap(); + map.putMap("stats", statsMap); + sendEvent(getReactApplicationContext(), "onLocalVideoStats", map); + } + }); + } + + @Override + public void onRemoteVideoStats(final RemoteVideoStats stats) { + runOnUiThread(new Runnable() { + @Override + public void run() { + WritableMap statsMap = Arguments.createMap(); + statsMap.putInt("uid", stats.uid); + statsMap.putInt("delay", stats.delay); + statsMap.putInt("receivedBitrate", stats.receivedBitrate); + statsMap.putInt("receivedFrameRate", stats.receivedFrameRate); + statsMap.putInt("rxStreamType", stats.rxStreamType); + WritableMap map = Arguments.createMap(); + map.putMap("stats", statsMap); + sendEvent(getReactApplicationContext(), "onRemoteVideoStats", map); + } + }); + } + + @Override + public void onRemoteAudioStats(final RemoteAudioStats stats) { + runOnUiThread(new Runnable() { + @Override + public void run() { + WritableMap statsMap = Arguments.createMap(); + statsMap.putInt("uid", stats.uid); + statsMap.putInt("quality", stats.quality); + statsMap.putInt("networkTransportDelay", stats.networkTransportDelay); + statsMap.putInt("jitterBufferDelay", stats.jitterBufferDelay); + statsMap.putInt("audioLossRate", stats.audioLossRate); + WritableMap map = Arguments.createMap(); + map.putMap("stats", statsMap); + sendEvent(getReactApplicationContext(), "onRemoteAudioStats", map); + } + }); + } + + @Override + public void onRemoteAudioTransportStats(final int uid, + final int delay, + final int lost, + final int rxKBitRate) { + runOnUiThread(new Runnable() { + @Override + public void run() { + WritableMap statsMap = Arguments.createMap(); + statsMap.putInt("uid", uid); + statsMap.putInt("delay", delay); + statsMap.putInt("lost", lost); + statsMap.putInt("rxKBitRate", rxKBitRate); + WritableMap map = Arguments.createMap(); + map.putMap("stats", statsMap); + sendEvent(getReactApplicationContext(), "onRemoteAudioTransportStats", map); + } + }); + } + + @Override + public void onRemoteVideoTransportStats(final int uid, + final int delay, + final int lost, + final int rxKBitRate) { + runOnUiThread(new Runnable() { + @Override + public void run() { + WritableMap statsMap = Arguments.createMap(); + statsMap.putInt("uid", uid); + statsMap.putInt("delay", delay); + statsMap.putInt("lost", lost); + statsMap.putInt("rxKBitRate", rxKBitRate); + WritableMap map = Arguments.createMap(); + map.putMap("stats", statsMap); + sendEvent(getReactApplicationContext(), "onRemoteVideoTransportStats", map); + } + }); + } + + @Override + public void onAudioMixingFinished() { + runOnUiThread(new Runnable() { + @Override + public void run() { + WritableMap map = Arguments.createMap(); + map.putString("message", "LocalAudioMixingSucceedFinish"); + sendEvent(getReactApplicationContext(), "onAudioMixingFinish", map); + } + }); + } + + @Override + public void onAudioEffectFinished(final int soundId) { + runOnUiThread(new Runnable() { + @Override + public void run() { + WritableMap map = Arguments.createMap(); + map.putInt("soundId", soundId); + sendEvent(getReactApplicationContext(), "onAudioEffectFinished", map); + } + }); + } + + @Override + public void onStreamPublished(final String url, final int error) { + runOnUiThread(new Runnable() { + @Override + public void run() { + WritableMap map = Arguments.createMap(); + map.putString("url", url); + map.putInt("error", error); + sendEvent(getReactApplicationContext(), "onStreamPublished", map); + } + }); + } + + @Override + public void onStreamUnpublished(final String url) { + runOnUiThread(new Runnable() { + @Override + public void run() { + WritableMap map = Arguments.createMap(); + map.putString("url", url); + sendEvent(getReactApplicationContext(), "onStreamUnpublished", map); + } + }); + } + + @Override + public void onTranscodingUpdated() { + runOnUiThread(new Runnable() { + @Override + public void run() { + WritableMap map = Arguments.createMap(); + map.putString("message", "TranscodingUpdated"); + sendEvent(getReactApplicationContext(), "onTranscodingUpdated", map); + } + }); + } + + @Override + public void onStreamInjectedStatus(final String url, final int uid, final int status) { + runOnUiThread(new Runnable() { + @Override + public void run() { + WritableMap map = Arguments.createMap(); + map.putString("url", url); + map.putInt("uid", uid); + map.putInt("status", status); + sendEvent(getReactApplicationContext(), "onStreamInjectedStatus", map); + } + }); + } + + /** + * onStreamMessage + */ + @Override + public void onStreamMessage(final int uid, final int streamId, final byte[] data) { + runOnUiThread(new Runnable() { + @Override + public void run() { + String msg = new String(data); + WritableMap map = Arguments.createMap(); + map.putInt("uid", uid); + map.putInt("streamId", streamId); + map.putString("data", msg); + sendEvent(getReactApplicationContext(), "onStreamMessage", map); + } + }); + } + + @Override + public void onStreamMessageError(final int uid, final int streamId, final int code, final int missed, final int cached) { + runOnUiThread(new Runnable() { + @Override + public void run() { + WritableMap map = Arguments.createMap(); + map.putString("type", "onStreamMessageError"); + map.putInt("uid", uid); + map.putInt("streamId", streamId); + map.putInt("error", code); + map.putInt("missed", missed); + map.putInt("cached", cached); + sendEvent(getReactApplicationContext(), "onStreamMessageError", map); + } + }); + } + + @Override + public void onMediaEngineLoadSuccess() { + runOnUiThread(new Runnable() { + @Override + public void run() { + WritableMap map = Arguments.createMap(); + map.putString("message", "onMediaEngineLoadSuccess"); + sendEvent(getReactApplicationContext(), "onMediaEngineLoadSuccess", map); + } + }); + } + + @Override + public void onMediaEngineStartCallSuccess() { + runOnUiThread(new Runnable() { + @Override + public void run() { + WritableMap map = Arguments.createMap(); + map.putString("message", "onMediaEngineStartCallSuccess"); + sendEvent(getReactApplicationContext(), "onMediaEngineStartCallSuccess", map); + } + }); + } + }; + + @ReactMethod + public void init(ReadableMap options) { + AgoraManager.getInstance().init(getReactApplicationContext(), mRtcEventHandler, options); } - //设置本地视频显示模式 @ReactMethod - public void setLocalRenderMode(int mode) { - AgoraManager.getInstance().mRtcEngine.setLocalRenderMode(mode); + public void renewToken(String token, + Promise promise) { + try { + int res = AgoraManager.getInstance().renewToken(token); + if (res != 0) throw new ReactNativeAgoraException("renewToken Failed", res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + promise.resolve(map); + } catch (Exception e) { + promise.reject("131002", e); + } } - //设置远端视频显示模式 @ReactMethod - public void setRemoteRenderMode(int uid, int mode) { - AgoraManager.getInstance().mRtcEngine.setRemoteRenderMode(uid, mode); + public void enableWebSdkInteroperability(boolean enabled, Promise promise) { + try { + int res = AgoraManager.getInstance().enableWebSdkInteroperability(enabled); + if (res != 0) throw new ReactNativeAgoraException("enableWebSdkInteroperability Failed", res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + promise.resolve(map); + } catch (Exception e) { + promise.reject("131003", e); + } } - //启用说话者音量提示 @ReactMethod - public void enableAudioVolumeIndication(int interval, int smooth) { - AgoraManager.getInstance().mRtcEngine.enableAudioVolumeIndication(interval, smooth); + public void getConnectionState(Promise promise) { + try { + int res = AgoraManager.getInstance().getConnectionState(); + if (res != 0) throw new ReactNativeAgoraException("getConnectionState Failed", res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putInt("state", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject("141001", e); + } } - //打开音频 @ReactMethod - public void enableAudio() { - AgoraManager.getInstance().mRtcEngine.enableAudio(); + public void setClientRole(int role) { + try { + int res = AgoraManager.getInstance().setClientRole(role); + if (res != 0) throw new ReactNativeAgoraException("setClientRole Failed", res); + } catch (Exception e) { + WritableMap err = Arguments.createMap(); + err.putBoolean("success", false); + err.putString("message", e.toString()); + sendEvent(getReactApplicationContext(), "onError", err); + } } - //关闭音频 @ReactMethod - public void disableAudio() { - AgoraManager.getInstance().mRtcEngine.disableAudio(); + public void joinChannel(ReadableMap options) { + try { + int res = AgoraManager.getInstance().joinChannel(options); + if (res != 0) throw new ReactNativeAgoraException("joinChannel Failed", res); + } catch (Exception e) { + WritableMap err = Arguments.createMap(); + err.putBoolean("success", false); + err.putString("message", e.toString()); + sendEvent(getReactApplicationContext(), "onError", err); + } } - //打开视频 @ReactMethod - public void enableVideo() { - AgoraManager.getInstance().mRtcEngine.enableVideo(); + public void leaveChannel(Promise promise) { + try { + int res = AgoraManager.getInstance().leaveChannel(); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + promise.resolve(map); + } catch (Exception e) { + promise.reject("141002", e); + } } - //关闭视频 @ReactMethod - public void disableVideo() { - AgoraManager.getInstance().mRtcEngine.disableVideo(); + public void destroy() { + RtcEngine.destroy(); + } + + @ReactMethod + public void setupLocalVideo() { + try { + int res = AgoraManager.getInstance().setupLocalVideo(); + if (res != 0) throw new ReactNativeAgoraException("setupLocalVideo Failed", res); + } catch (Exception e) { + WritableMap err = Arguments.createMap(); + err.putBoolean("success", false); + err.putString("message", e.toString()); + sendEvent(getReactApplicationContext(), "onError", err); + } + } + + @ReactMethod + public void setupRemoteVideo(int uid) { + try { + int res = AgoraManager.getInstance().setupRemoteVideo(uid); + if (res != 0) throw new ReactNativeAgoraException("setupRemoteVideo Failed", res); + } catch(Exception e) { + WritableMap err = Arguments.createMap(); + err.putBoolean("success", false); + err.putString("message", e.toString()); + sendEvent(getReactApplicationContext(), "onError", err); + } + } + + @ReactMethod + public void startPreview() { + AgoraManager.getInstance().startPreview(); } - //切换前置/后置摄像头 @ReactMethod - public void switchCamera() { - AgoraManager.getInstance().mRtcEngine.switchCamera(); + public void stopPreview() { + AgoraManager.getInstance().stopPreview(); } - //打开扬声器 @ReactMethod public void setEnableSpeakerphone(boolean enabled) { - AgoraManager.getInstance().mRtcEngine.setEnableSpeakerphone(enabled); + try { + int res = AgoraManager.getInstance().setEnableSpeakerphone(enabled); + if (res != 0) throw new ReactNativeAgoraException("setEnableSpeakerphone Failed", res); + } catch (Exception e) { + WritableMap err = Arguments.createMap(); + err.putBoolean("success", false); + err.putString("message", e.toString()); + sendEvent(getReactApplicationContext(), "onError", err); + } } - //将自己静音 @ReactMethod - public void muteLocalAudioStream(boolean muted) { - AgoraManager.getInstance().mRtcEngine.muteLocalAudioStream(muted); + public void setDefaultAudioRouteToSpeakerphone(boolean enabled) { + try { + int res = AgoraManager.getInstance().setDefaultAudioRouteToSpeakerphone(enabled); + if (res != 0) throw new ReactNativeAgoraException("setDefaultAudioRouteToSpeakerphone Failed", res); + } catch (Exception e) { + WritableMap err = Arguments.createMap(); + err.putBoolean("success", false); + err.putString("message", e.toString()); + sendEvent(getReactApplicationContext(), "onError", err); + } } - //静音所有远端音频 @ReactMethod - public void muteAllRemoteAudioStreams(boolean muted) { - AgoraManager.getInstance().mRtcEngine.muteAllRemoteAudioStreams(muted); + public void enableVideo() { + AgoraManager.getInstance().mRtcEngine.enableVideo(); } - //静音指定用户音频 @ReactMethod - public void muteRemoteAudioStream(int uid, boolean muted) { - AgoraManager.getInstance().mRtcEngine.muteRemoteAudioStream(uid, muted); + public void disableVideo() { + AgoraManager.getInstance().mRtcEngine.disableVideo(); } - //禁用本地视频功能 @ReactMethod public void enableLocalVideo(boolean enabled) { AgoraManager.getInstance().mRtcEngine.enableLocalVideo(enabled); } - //暂停本地视频流 @ReactMethod public void muteLocalVideoStream(boolean muted) { AgoraManager.getInstance().mRtcEngine.muteLocalVideoStream(muted); } - //暂停所有远端视频流 @ReactMethod public void muteAllRemoteVideoStreams(boolean muted) { AgoraManager.getInstance().mRtcEngine.muteAllRemoteVideoStreams(muted); } - //暂停指定远端视频流 @ReactMethod public void muteRemoteVideoStream(int uid, boolean muted) { AgoraManager.getInstance().mRtcEngine.muteRemoteVideoStream(uid, muted); } + @ReactMethod + public void setDefaultMuteAllRemoteVideoStreams(boolean muted) { + AgoraManager.getInstance().mRtcEngine.setDefaultMuteAllRemoteVideoStreams(muted); + } - //设置是否打开闪光灯 @ReactMethod - public void setCameraTorchOn(boolean isOn) { - AgoraManager.getInstance().mRtcEngine.setCameraTorchOn(isOn); + public void switchCamera(Promise promise) { + try { + int res = AgoraManager.getInstance().mRtcEngine.switchCamera(); + if (res != 0) throw new ReactNativeAgoraException("switchCamera Failed", res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putInt("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject(e); + } } - //设置是否开启人脸对焦功能 @ReactMethod - public void setCameraAutoFocusFaceModeEnabled(boolean enabled) { - AgoraManager.getInstance().mRtcEngine.setCameraAutoFocusFaceModeEnabled(enabled); + public void isCameraZoomSupported(Promise promise) { + try { + boolean res = AgoraManager.getInstance().mRtcEngine.isCameraZoomSupported(); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putBoolean("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject(e); + } } - //修改默认的语音路由 True: 默认路由改为外放(扬声器) False: 默认路由改为听筒 + @ReactMethod - public void setDefaultAudioRouteToSpeakerphone(boolean defaultToSpeaker) { - AgoraManager.getInstance().mRtcEngine.setDefaultAudioRoutetoSpeakerphone(defaultToSpeaker); + public void isCameraTorchSupported(Promise promise) { + try { + boolean res = AgoraManager.getInstance().mRtcEngine.isCameraTorchSupported(); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putBoolean("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject(e); + } } - // 建立数据通道 @ReactMethod - public void createDataStream(boolean reliable, boolean ordered, Callback callback) { - callback.invoke(AgoraManager.getInstance().mRtcEngine.createDataStream(reliable, ordered)); + public void isCameraFocusSupported(Promise promise) { + try { + boolean res = AgoraManager.getInstance().mRtcEngine.isCameraFocusSupported(); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putBoolean("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject(e); + } } - // 发送数据 @ReactMethod - public void sendStreamMessage(int streamId, String message, Callback onError) { - onError.invoke(AgoraManager.getInstance().mRtcEngine.sendStreamMessage(streamId, message.getBytes())); + public void isCameraExposurePositionSupported(Promise promise) { + try { + boolean res = AgoraManager.getInstance().mRtcEngine.isCameraExposurePositionSupported(); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putBoolean("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject(e); + } } - //销毁引擎实例 + @ReactMethod - public void destroy() { - RtcEngine.destroy(); + public void isCameraAutoFocusFaceModeSupported(Promise promise) { + try { + boolean res = AgoraManager.getInstance().mRtcEngine.isCameraAutoFocusFaceModeSupported(); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putBoolean("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject(e); + } + } + + @ReactMethod + public void setCameraZoomFactor(float factor, Promise promise) { + try { + int res = AgoraManager.getInstance().mRtcEngine.setCameraZoomFactor(factor); + if (res != 0) throw new ReactNativeAgoraException("setCameraZoomFactor Failed", res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putInt("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject(e); + } + } + + @ReactMethod + public void setCameraFocusPositionInPreview(ReadableMap options, Promise promise) { + try { + int res = AgoraManager.getInstance().mRtcEngine.setCameraFocusPositionInPreview( + (float)options.getDouble("x"), + (float)options.getDouble("y") + ); + if (res != 0) throw new ReactNativeAgoraException("setCameraFocusPositionInPreview Failed", res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putInt("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject(e); + } + } + + @ReactMethod + public void setCameraExposurePosition(ReadableMap options, Promise promise) { + try { + int res = AgoraManager.getInstance().mRtcEngine.setCameraExposurePosition( + (float)options.getDouble("x"), + (float)options.getDouble("y") + ); + if (res != 0) throw new ReactNativeAgoraException("setCameraExposurePosition Failed", res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putInt("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject(e); + } } - //查询 SDK 版本号 @ReactMethod - public void getSdkVersion(Callback callback) { - callback.invoke(RtcEngine.getSdkVersion()); + public void setCameraTorchOn(boolean isOn, Promise promise) { + try { + int res = AgoraManager.getInstance().mRtcEngine.setCameraTorchOn(isOn); + if (res != 0) throw new ReactNativeAgoraException("setCameraTorchOn Failed", res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putInt("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject(e); + } } - private void commonEvent(WritableMap map) { - sendEvent(getReactApplicationContext(), "agoraEvent", map); + @ReactMethod + public void setCameraAutoFocusFaceModeEnabled(boolean enabled, Promise promise) { + try { + int res = AgoraManager.getInstance().mRtcEngine.setCameraAutoFocusFaceModeEnabled(enabled); + if (res != 0) throw new ReactNativeAgoraException("setCameraTorchOn Failed", res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putInt("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject(e); + } + } + + @ReactMethod + public void getCallId(Promise promise) { + try { + String res = AgoraManager.getInstance().mRtcEngine.getCallId(); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putString("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject(e); + } + } + + @ReactMethod + public void setLog(String filePath, int level, Promise promise) { + try { + int res = 0; + res = AgoraManager.getInstance().mRtcEngine.setLogFilter(level); + if (res != 0) throw new ReactNativeAgoraException("setLogFilter Failed", res); + res = AgoraManager.getInstance().mRtcEngine.setLogFile(filePath); + if (res != 0) throw new ReactNativeAgoraException("setLogFile Failed", res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putInt("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject(e); + } + } + + + @ReactMethod + public void enableAudio() { + AgoraManager.getInstance().mRtcEngine.enableAudio(); + } + + @ReactMethod + public void disableAudio() { + AgoraManager.getInstance().mRtcEngine.disableAudio(); + } + + @ReactMethod + public void muteAllRemoteAudioStreams(boolean muted) { + AgoraManager.getInstance().mRtcEngine.muteAllRemoteAudioStreams(muted); + } + + @ReactMethod + public void muteRemoteAudioStream(int uid, boolean muted) { + AgoraManager.getInstance().mRtcEngine.muteRemoteAudioStream(uid, muted); + } + + @ReactMethod + public void setDefaultMuteAllRemoteAudioStreams(boolean muted) { + AgoraManager.getInstance().mRtcEngine.setDefaultMuteAllRemoteAudioStreams(muted); + } + + @ReactMethod + public void adjustRecordingSignalVolume(int volume) { + try { + int res = AgoraManager.getInstance().mRtcEngine.adjustRecordingSignalVolume(volume); + if (res != 0) throw new ReactNativeAgoraException("adjustRecordingSignalVolume Failed", res); + } catch(Exception e) { + WritableMap err = Arguments.createMap(); + err.putBoolean("success", false); + err.putString("message", e.toString()); + sendEvent(getReactApplicationContext(), "onError", err); + } + } + + @ReactMethod + public void adjustPlaybackSignalVolume(int volume) { + try { + int res = AgoraManager.getInstance().mRtcEngine.adjustPlaybackSignalVolume(volume); + if (res != 0) throw new ReactNativeAgoraException("adjustPlaybackSignalVolume Failed", res); + } catch(Exception e) { + WritableMap err = Arguments.createMap(); + err.putBoolean("success", false); + err.putString("message", e.toString()); + sendEvent(getReactApplicationContext(), "onError", err); + } + } + + @ReactMethod + public void enableAudioVolumeIndication(int interval, int smooth) { + AgoraManager.getInstance().mRtcEngine.enableAudioVolumeIndication(interval, smooth); + } + + @ReactMethod + public void enableLocalAudio(boolean enabled) { + AgoraManager.getInstance().mRtcEngine.enableLocalAudio(enabled); + } + + @ReactMethod + public void muteLocalAudioStream(boolean enabled) { + AgoraManager.getInstance().mRtcEngine.muteLocalAudioStream(enabled); + } + + @ReactMethod + public void createDataStream(ReadableMap options, Promise promise) { + try { + int res = AgoraManager.getInstance().mRtcEngine + .createDataStream( + options.getBoolean("ordered"), + options.getBoolean("reliable") + ); + if (res != 0) throw new ReactNativeAgoraException("adjustPlaybackSignalVolume Failed", res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putString("message", "createDataStream"); + promise.resolve(map); + } catch(Exception e) { + promise.reject(e); + } + } + + @ReactMethod + public void methodisSpeakerphoneEnabled(Callback callback) { + WritableMap map = Arguments.createMap(); + map.putBoolean("status", AgoraManager.getInstance().mRtcEngine.isSpeakerphoneEnabled()); + callback.invoke(map); + } + + @ReactMethod + public void enableInEarMonitoring(boolean enabled) { + try { + int res = AgoraManager.getInstance().mRtcEngine.enableInEarMonitoring(enabled); + if (res != 0) throw new ReactNativeAgoraException("enableInEarMonitoring Failed", res); + } catch (Exception e) { + WritableMap err = Arguments.createMap(); + err.putBoolean("success", false); + err.putString("message", e.toString()); + sendEvent(getReactApplicationContext(), "onError", err); + } + } + + @ReactMethod + public void setInEarMonitoringVolume(int volume) { + try { + int res = AgoraManager.getInstance().mRtcEngine.setInEarMonitoringVolume(volume); + if (res != 0) throw new ReactNativeAgoraException("setInEarMonitoringVolume Failed", res); + } catch (Exception e) { + WritableMap err = Arguments.createMap(); + err.putBoolean("success", false); + err.putString("message", e.toString()); + sendEvent(getReactApplicationContext(), "onError", err); + } + } + + @ReactMethod + public void setLocalVoicePitch(double pitch) { + try { + int res = AgoraManager.getInstance().mRtcEngine.setLocalVoicePitch(pitch); + if (res != 0) throw new ReactNativeAgoraException("setLocalVoicePitch Failed", res); + } catch (Exception e) { + WritableMap err = Arguments.createMap(); + err.putBoolean("success", false); + err.putString("message", e.toString()); + sendEvent(getReactApplicationContext(), "onError", err); + } + } + + @ReactMethod + public void setLocalVoiceEqualization(int band, int gain) { + try { + int res = AgoraManager.getInstance().mRtcEngine.setLocalVoiceEqualization(band, gain); + if (res != 0) throw new ReactNativeAgoraException("setLocalVoiceEqualization Failed", res); + } catch (Exception e) { + WritableMap err = Arguments.createMap(); + err.putBoolean("success", false); + err.putString("message", e.toString()); + sendEvent(getReactApplicationContext(), "onError", err); + } + } + + @ReactMethod + public void setLocalVoiceReverb(int reverb, int value) { + try { + int res = AgoraManager.getInstance().mRtcEngine.setLocalVoiceReverb(reverb, value); + if (res != 0) throw new ReactNativeAgoraException("setLocalVoiceReverb Failed", res); + } catch (Exception e) { + WritableMap err = Arguments.createMap(); + err.putBoolean("success", false); + err.putString("message", e.toString()); + sendEvent(getReactApplicationContext(), "onError", err); + } + } + + @ReactMethod + public void startAudioMixing(ReadableMap options) { + try { + int res = AgoraManager.getInstance().mRtcEngine.startAudioMixing( + options.getString("filepath"), + options.getBoolean("loopback"), + options.getBoolean("replace"), + options.getInt("cycle") + ); + if (res != 0) throw new ReactNativeAgoraException("startAudioMixing Failed", res); + } catch (Exception e) { + WritableMap err = Arguments.createMap(); + err.putBoolean("success", false); + err.putString("message", e.toString()); + sendEvent(getReactApplicationContext(), "onError", err); + } + } + + @ReactMethod + public void stopAudioMixing() { + try { + int res = AgoraManager.getInstance().mRtcEngine.stopAudioMixing(); + if (res != 0) throw new ReactNativeAgoraException("stopAudioMixing Failed", res); + } catch (Exception e) { + WritableMap err = Arguments.createMap(); + err.putBoolean("success", false); + err.putString("message", e.toString()); + sendEvent(getReactApplicationContext(), "onError", err); + } + } + + @ReactMethod + public void pauseAudioMixing() { + try { + int res = AgoraManager.getInstance().mRtcEngine.pauseAudioMixing(); + if (res != 0) throw new ReactNativeAgoraException("pauseAudioMixing Failed", res); + } catch (Exception e) { + WritableMap err = Arguments.createMap(); + err.putBoolean("success", false); + err.putString("message", e.toString()); + sendEvent(getReactApplicationContext(), "onError", err); + } + } + + @ReactMethod + public void resumeAudioMixing() { + try { + int res = AgoraManager.getInstance().mRtcEngine.resumeAudioMixing(); + if (res != 0) throw new ReactNativeAgoraException("resumeAudioMixing Failed", res); + } catch (Exception e) { + WritableMap err = Arguments.createMap(); + err.putBoolean("success", false); + err.putString("message", e.toString()); + sendEvent(getReactApplicationContext(), "onError", err); + } + } + + @ReactMethod + public void adjustAudioMixingVolume(int volume) { + try { + int res = AgoraManager.getInstance().mRtcEngine.adjustAudioMixingVolume(volume); + if (res != 0) throw new ReactNativeAgoraException("adjustAudioMixingVolume Failed", res); + } catch (Exception e) { + WritableMap err = Arguments.createMap(); + err.putBoolean("success", false); + err.putString("message", e.toString()); + sendEvent(getReactApplicationContext(), "onError", err); + } + } + + @ReactMethod + public void adjustAudioMixingPlayoutVolume(int volume) { + try { + int res = AgoraManager.getInstance().mRtcEngine.adjustAudioMixingPlayoutVolume(volume); + if (res != 0) throw new ReactNativeAgoraException("adjustAudioMixingPlayoutVolume Failed", res); + } catch (Exception e) { + WritableMap err = Arguments.createMap(); + err.putBoolean("success", false); + err.putString("message", e.toString()); + sendEvent(getReactApplicationContext(), "onError", err); + } + } + + @ReactMethod + public void adjustAudioMixingPublishVolume(int volume) { + try { + int res = AgoraManager.getInstance().mRtcEngine.adjustAudioMixingPublishVolume(volume); + if (res != 0) throw new ReactNativeAgoraException("adjustAudioMixingPublishVolume Failed", res); + } catch (Exception e) { + WritableMap err = Arguments.createMap(); + err.putBoolean("success", false); + err.putString("message", e.toString()); + sendEvent(getReactApplicationContext(), "onError", err); + } + } + + @ReactMethod + public void getAudioMixingDuration(Promise promise) { + try { + int res = AgoraManager.getInstance().mRtcEngine.getAudioMixingDuration(); + if (res != 0) throw new ReactNativeAgoraException("getAudioMixingDuration Failed", res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putInt("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject("131004", e); + } + } + + @ReactMethod + public void getAudioMixingCurrentPosition(Promise promise) { + try { + int res = AgoraManager.getInstance().mRtcEngine.getAudioMixingCurrentPosition(); + if (res != 0) throw new ReactNativeAgoraException("getAudioMixingCurrentPosition Failed", res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putInt("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject("131005", e); + } + } + + @ReactMethod + public void setAudioMixingPosition(int pos, Promise promise) { + try { + int res = AgoraManager.getInstance().mRtcEngine.setAudioMixingPosition(pos); + if (res != 0) throw new ReactNativeAgoraException("setAudioMixingPosition Failed", res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + promise.resolve(map); + } catch (Exception e) { + promise.reject("131006", e); + } + } + + @ReactMethod + public void startAudioRecording(ReadableMap options, Promise promise) { + try { + int res = AgoraManager.getInstance().mRtcEngine + .startAudioRecording( + options.getString("filePath"), + options.getInt("quality") + ); + if (res != 0) throw new ReactNativeAgoraException("startAudioRecording Failed", res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putInt("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject("131007", e); + } + } + + @ReactMethod + public void stopAudioRecording(Promise promise) { + try { + int res = AgoraManager.getInstance().mRtcEngine + .stopAudioRecording(); + if (res != 0) throw new ReactNativeAgoraException("stopAudioRecording Failed", res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putInt("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject("131008", e); + } + } + + @ReactMethod + public void startEchoTest(Promise promise) { + try { + int res = AgoraManager.getInstance().mRtcEngine + .startEchoTest(); + if (res != 0) throw new ReactNativeAgoraException("startEchoTest Failed", res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putInt("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject("131009", e); + } + } + + @ReactMethod + public void stopEchoTest(Promise promise) { + try { + int res = AgoraManager.getInstance().mRtcEngine + .stopEchoTest(); + if (res != 0) throw new ReactNativeAgoraException("stopEchoTest Failed", res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putInt("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject("131010", e); + } + } + + @ReactMethod + public void enableLastmileTest(Promise promise) { + try { + int res = AgoraManager.getInstance().mRtcEngine + .enableLastmileTest(); + if (res != 0) throw new ReactNativeAgoraException("enableLastmileTest Failed", res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putInt("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject("131021", e); + } + } + + @ReactMethod + public void disableLastmileTest(Promise promise) { + try { + int res = AgoraManager.getInstance().mRtcEngine + .enableLastmileTest(); + if (res != 0) throw new ReactNativeAgoraException("disableLastmileTest Failed", res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putInt("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject("131022", e); + } + } + + @ReactMethod + public void setRecordingAudioFrameParameters(WritableMap options, Promise promise) { + try { + int res = AgoraManager.getInstance().mRtcEngine + .setRecordingAudioFrameParameters( + options.getInt("sampleRate"), + options.getInt("channel"), + options.getInt("mode"), + options.getInt("samplesPerCall") + ); + if (res != 0) throw new ReactNativeAgoraException("setRecordingAudioFrameParameters Failed", res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putInt("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject("131023", e); + } + } + + @ReactMethod + public void setPlaybackAudioFrameParameters(WritableMap options, Promise promise) { + try { + int res = AgoraManager.getInstance().mRtcEngine + .setPlaybackAudioFrameParameters( + options.getInt("sampleRate"), + options.getInt("channel"), + options.getInt("mode"), + options.getInt("samplesPerCall") + ); + if (res != 0) throw new ReactNativeAgoraException("setPlaybackAudioFrameParameters Failed", res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putInt("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject("131024", e); + } + } + + @ReactMethod + public void setMixedAudioFrameParameters(WritableMap options, Promise promise) { + try { + int res = AgoraManager.getInstance().mRtcEngine + .setMixedAudioFrameParameters( + options.getInt("sampleRate"), + options.getInt("samplesPerCall") + ); + if (res != 0) throw new ReactNativeAgoraException("setMixedAudioFrameParameters Failed", res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putInt("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject("131025", e); + } + } + + public AgoraImage createAgoraImage(ReadableMap options) { + AgoraImage image = new AgoraImage(); + image.url = options.getString("url"); + image.height = options.getInt("height"); + image.width = options.getInt("width"); + image.x = options.getInt("x"); + image.y = options.getInt("y"); + return image; + } + + @ReactMethod + public void addVideoWatermark(WritableMap options, Promise promise) { + try { + int res = AgoraManager.getInstance().mRtcEngine + .addVideoWatermark(createAgoraImage(options)); + if (res != 0) throw new ReactNativeAgoraException("addVideoWatermark Failed", res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putInt("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject("131026", e); + } + } + + @ReactMethod + public void clearVideoWatermarks(Promise promise) { + try { + int res = AgoraManager.getInstance().mRtcEngine + .clearVideoWatermarks(); + if (res != 0) throw new ReactNativeAgoraException("clearVideoWatermarks Failed", res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putInt("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject("131027", e); + } + } + + @ReactMethod + public void setLocalPublishFallbackOption(int option, Promise promise) { + try { + int res = AgoraManager.getInstance().mRtcEngine + .setLocalPublishFallbackOption(option); + if (res != 0) throw new ReactNativeAgoraException("setLocalPublishFallbackOption Failed", res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putInt("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject("131028", e); + } + } + + @ReactMethod + public void setRemoteSubscribeFallbackOption(int option, Promise promise) { + try { + int res = AgoraManager.getInstance().mRtcEngine + .setRemoteSubscribeFallbackOption(option); + if (res != 0) throw new ReactNativeAgoraException("setRemoteSubscribeFallbackOption Failed", res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putInt("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject("131029", e); + } + } + + @ReactMethod + public void enableDualStreamMode(boolean enabled, Promise promise) { + try { + int res = AgoraManager.getInstance().mRtcEngine + .enableDualStreamMode(enabled); + if (res != 0) throw new ReactNativeAgoraException("enableDualStreamMode Failed", res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putInt("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject("131028", e); + } + } + + + @ReactMethod + public void setRemoteVideoStreamType(ReadableMap options, Promise promise) { + try { + int res = AgoraManager.getInstance().mRtcEngine + .setRemoteVideoStreamType( + options.getInt("uid"), + options.getInt("streamType") + ); + if (res != 0) throw new ReactNativeAgoraException("setRemoteVideoStreamType Failed", res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putInt("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject("131029", e); + } + } + + @ReactMethod + public void setRemoteDefaultVideoStreamType(ReadableMap options, Promise promise) { + try { + int res = AgoraManager.getInstance().mRtcEngine + .setRemoteDefaultVideoStreamType( + options.getInt("streamType") + ); + if (res != 0) throw new ReactNativeAgoraException("setRemoteDefaultVideoStreamType Failed", res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putInt("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject("131030", e); + } + } + + public AudioSampleRateType getAudioSampleRateEnum (int val) { + AudioSampleRateType type = AudioSampleRateType.TYPE_32000; + switch (Integer.valueOf(val)) { + case 32000: + type = AudioSampleRateType.TYPE_32000; + break; + case 44100: + type = AudioSampleRateType.TYPE_44100; + break; + case 48000: + type = AudioSampleRateType.TYPE_48000; + break; + } + return type; + } + + public LiveTranscoding.AudioSampleRateType getLiveTranscodingAudioSampleRateEnum (int val) { + LiveTranscoding.AudioSampleRateType type = LiveTranscoding.AudioSampleRateType.TYPE_32000; + switch (Integer.valueOf(val)) { + case 32000: + type = LiveTranscoding.AudioSampleRateType.TYPE_32000; + break; + case 44100: + type = LiveTranscoding.AudioSampleRateType.TYPE_44100; + break; + case 48000: + type = LiveTranscoding.AudioSampleRateType.TYPE_48000; + break; + } + return type; + } + + + @ReactMethod + public void addInjectStreamUrl(ReadableMap options, Promise promise) { + try { + LiveInjectStreamConfig config = new LiveInjectStreamConfig(); + config.width = options.getInt("width"); + config.height = options.getInt("height"); + config.videoGop = options.getInt("videoGop"); + config.videoBitrate = options.getInt("videoBitrate"); + config.videoFramerate = options.getInt("videoFramerate"); + config.audioBitrate = options.getInt("audioBitrate"); + config.audioSampleRate = getAudioSampleRateEnum(options.getInt("audioSampleRate")); + config.audioChannels = options.getInt("audioChannels"); + + + int res = AgoraManager.getInstance().mRtcEngine + .addInjectStreamUrl( + options.getString("url"), + config + ); + if (res != 0) throw new ReactNativeAgoraException("addInjectStreamUrl Failed", res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putInt("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject("131031", e); + } + } + + @ReactMethod + public void removeInjectStreamUrl(ReadableMap options, Promise promise) { + try { + int res = AgoraManager.getInstance().mRtcEngine + .removeInjectStreamUrl(options.getString("url")); + if (res != 0) throw new ReactNativeAgoraException("removeInjectStreamUrl Failed", res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putInt("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject("131032", e); + } + } + + @ReactMethod + public void addPublishStreamUrl(ReadableMap options, Promise promise) { + try { + int res = AgoraManager.getInstance().mRtcEngine + .addPublishStreamUrl( + options.getString("url"), + options.getBoolean("enable") + ); + if (res != 0) throw new ReactNativeAgoraException("addPublishStreamUrl Failed", res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putInt("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject("131033", e); + } + } + + @ReactMethod + public void removePublishStreamUrl(ReadableMap options, Promise promise) { + try { + int res = AgoraManager.getInstance().mRtcEngine + .removePublishStreamUrl(options.getString("url")); + if (res != 0) throw new ReactNativeAgoraException("removePublishStreamUrl Failed", res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putInt("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject("131034", e); + } + } + + @ReactMethod + public void setLiveTranscoding(ReadableMap options) { + try { + LiveTranscoding transcoding = new LiveTranscoding(); + ReadableMap size = options.getMap("size"); + if (size != null) { + transcoding.width = size.getInt("width"); + transcoding.height = size.getInt("height"); + } + if (options.hasKey("videoBitrate")) { + transcoding.videoBitrate = options.getInt("videoBitrate"); + } + if (options.hasKey("videoFramerate")) { + transcoding.videoFramerate = options.getInt("videoFramerate"); + } + if (options.hasKey("lowLatency")) { + transcoding.lowLatency = options.getBoolean("lowLatency"); + } + if (options.hasKey("videoGop")) { + transcoding.videoGop = options.getInt("videoGop"); + } + if (options.hasKey("videoCodecProfile")) { + transcoding.videoGop = options.getInt("videoCodecProfile"); + } + if (options.hasKey("transcodingUsers")) { + ArrayList users = new ArrayList(); + ReadableArray transcodingUsers = options.getArray("transcodingUsers"); + for (int i = 0; i < transcodingUsers.size(); i++) { + ReadableMap _map = transcodingUsers.getMap(i); + LiveTranscoding.TranscodingUser user = new LiveTranscoding.TranscodingUser(); + user.uid = _map.getInt("uid"); + ReadableMap backgroundColor = _map.getMap("backgroundColor"); + user.x = backgroundColor.getInt("x"); + user.y = backgroundColor.getInt("y"); + user.width = backgroundColor.getInt("width"); + user.height = backgroundColor.getInt("height"); + user.zOrder = _map.getInt("zOrder"); + user.alpha = _map.getInt("alpha"); + user.audioChannel = _map.getInt("audioChannel"); + users.add(user); + } + transcoding.setUsers(users); + } + if (options.hasKey("transcodingExtraInfo")) { + transcoding.userConfigExtraInfo = options.getString("transcodingExtraInfo"); + } + if (options.hasKey("watermark")) { + ReadableMap watermark = options.getMap("watermark"); + WritableMap map = Arguments.createMap(); + map.putString("url", watermark.getString("url")); + map.putString("x", watermark.getString("x")); + map.putString("y", watermark.getString("y")); + map.putString("width", watermark.getString("width")); + map.putString("height", watermark.getString("height")); + transcoding.watermark = createAgoraImage(map); + } + if (options.hasKey("backgroundImage")) { + ReadableMap watermark = options.getMap("backgroundImage"); + WritableMap map = Arguments.createMap(); + map.putString("url", watermark.getString("url")); + map.putString("x", watermark.getString("x")); + map.putString("y", watermark.getString("y")); + map.putString("width", watermark.getString("width")); + map.putString("height", watermark.getString("height")); + transcoding.backgroundImage = createAgoraImage(map); + } + if (options.hasKey("backgroundColor")) { + ReadableMap backgroundColor = options.getMap("backgroundColor"); + transcoding.setBackgroundColor( + backgroundColor.getInt("red"), + backgroundColor.getInt("green"), + backgroundColor.getInt("blue") + ); + } + if (options.hasKey("audioSampleRate")) { + transcoding.audioSampleRate = getLiveTranscodingAudioSampleRateEnum(options.getInt("audioSampleRate")); + } + if (options.hasKey("audioBitrate")) { + transcoding.audioChannels = options.getInt("audioBitrate"); + } + if (options.hasKey("audioChannels")) { + transcoding.audioChannels = options.getInt("audioChannel"); + } + int res = AgoraManager.getInstance().mRtcEngine.setLiveTranscoding(transcoding); + if (res != 0) throw new ReactNativeAgoraException("setLiveTranscoding Failed", res); + } catch (Exception e) { + WritableMap err = Arguments.createMap(); + err.putBoolean("success", false); + err.putString("message", e.toString()); + sendEvent(getReactApplicationContext(), "onError", err); + } + } + + @ReactMethod + public void getEffectsVolume(Promise promise) { + try { + IAudioEffectManager manager = AgoraManager.getInstance().mRtcEngine.getAudioEffectManager(); + double res = manager.getEffectsVolume(); + if (res < 0) throw new ReactNativeAgoraException("getEffectsVolume Failed", (int)res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putDouble("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject(e); + } + } + + @ReactMethod + public void setEffectsVolume(double volume, Promise promise) { + try { + IAudioEffectManager manager = AgoraManager.getInstance().mRtcEngine.getAudioEffectManager(); + int res = manager.setEffectsVolume(volume); + if (res != 0) throw new ReactNativeAgoraException("setEffectsVolume Failed", (int)res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putInt("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject(e); + } + } + + + @ReactMethod + public void setVolumeOfEffect(int soundId, double volume, Promise promise) { + try { + IAudioEffectManager manager = AgoraManager.getInstance().mRtcEngine.getAudioEffectManager(); + int res = manager.setVolumeOfEffect(soundId, volume); + if (res != 0) throw new ReactNativeAgoraException("setVolumeOfEffect Failed", (int)res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putDouble("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject(e); + } + } + + @ReactMethod + public void playEffect(ReadableMap options, Promise promise) { + try { + IAudioEffectManager manager = AgoraManager.getInstance().mRtcEngine.getAudioEffectManager(); + int res = manager.playEffect( + options.getInt("soundId"), + options.getString("filePath"), + options.getInt("loopCount"), + options.getDouble("pitch"), + options.getDouble("pan"), + options.getDouble("gain"), + options.getBoolean("publish") + ); + if (res != 0) throw new ReactNativeAgoraException("playEffect Failed", (int)res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putInt("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject(e); + } + } + + + @ReactMethod + public void stopEffect(int soundId, Promise promise) { + try { + IAudioEffectManager manager = AgoraManager.getInstance().mRtcEngine.getAudioEffectManager(); + int res = manager.stopEffect(soundId); + if (res != 0) throw new ReactNativeAgoraException("stopEffect Failed", (int)res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putInt("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject(e); + } + } + + @ReactMethod + public void stopAllEffects(Promise promise) { + try { + IAudioEffectManager manager = AgoraManager.getInstance().mRtcEngine.getAudioEffectManager(); + int res = manager.stopAllEffects(); + if (res != 0) throw new ReactNativeAgoraException("stopAllEffects Failed", (int)res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putInt("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject(e); + } + } + + @ReactMethod + public void preloadEffect(int soundId, String filePath, Promise promise) { + try { + IAudioEffectManager manager = AgoraManager.getInstance().mRtcEngine.getAudioEffectManager(); + int res = manager.preloadEffect(soundId, filePath); + if (res != 0) throw new ReactNativeAgoraException("preloadEffect Failed", (int)res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putInt("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject(e); + } + } + + @ReactMethod + public void unloadEffect(int soundId, Promise promise) { + try { + IAudioEffectManager manager = AgoraManager.getInstance().mRtcEngine.getAudioEffectManager(); + int res = manager.unloadEffect(soundId); + if (res != 0) throw new ReactNativeAgoraException("unloadEffect Failed", (int)res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putInt("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject(e); + } + } + + @ReactMethod + public void pauseEffect(int soundId, Promise promise) { + try { + IAudioEffectManager manager = AgoraManager.getInstance().mRtcEngine.getAudioEffectManager(); + int res = manager.pauseEffect(soundId); + if (res != 0) throw new ReactNativeAgoraException("pauseEffect Failed", (int)res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putInt("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject(e); + } + } + + @ReactMethod + public void pauseAllEffects(Promise promise) { + try { + IAudioEffectManager manager = AgoraManager.getInstance().mRtcEngine.getAudioEffectManager(); + int res = manager.pauseAllEffects(); + if (res != 0) throw new ReactNativeAgoraException("pauseAllEffects Failed", (int)res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putInt("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject(e); + } + } + + @ReactMethod + public void resumeEffect(int soundId, Promise promise) { + try { + IAudioEffectManager manager = AgoraManager.getInstance().mRtcEngine.getAudioEffectManager(); + int res = manager.resumeEffect(soundId); + if (res != 0) throw new ReactNativeAgoraException("resumeEffect Failed", (int)res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putInt("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject(e); + } + } + + @ReactMethod + public void resumeAllEffects(int soundId, Promise promise) { + try { + IAudioEffectManager manager = AgoraManager.getInstance().mRtcEngine.getAudioEffectManager(); + int res = manager.resumeAllEffects(); + if (res != 0) throw new ReactNativeAgoraException("resumeAllEffects Failed", (int)res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putInt("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject(e); + } + } + + + //配置旁路直播推流 + @ReactMethod + public void configPublisher(ReadableMap options) { + PublisherConfiguration config = new PublisherConfiguration.Builder() + .owner(options.getBoolean("owner")) + .size(options.getInt("width"), options.getInt("height")) + .frameRate(options.getInt("framerate")) +// .biteRate(options.getInt("bitrate")) + .defaultLayout(options.getInt("defaultLayout")) + .streamLifeCycle(options.getInt("lifeCycle")) + .rawStreamUrl(options.getString("rawStreamUrl")) + .publishUrl(options.getString("publishUrl")) + .extraInfo(options.getString("extraInfo")) + .build(); + + AgoraManager.getInstance().mRtcEngine.configPublisher(config); + } + + //设置本地视频显示模式 + @ReactMethod + public void setLocalRenderMode(int mode) { + AgoraManager.getInstance().mRtcEngine.setLocalRenderMode(mode); + } + + //设置远端视频显示模式 + @ReactMethod + public void setRemoteRenderMode(int uid, int mode) { + AgoraManager.getInstance().mRtcEngine.setRemoteRenderMode(uid, mode); + } + + @ReactMethod + public void sendStreamMessage(int streamId, String data, Promise promise) { + try { + int res = AgoraManager.getInstance().mRtcEngine.sendStreamMessage(streamId, data.getBytes()); + if (res != 0) throw new ReactNativeAgoraException("sendStreamMessage Failed", res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + promise.resolve(map); + } catch (Exception e) { + promise.reject(e); + } + } + + @ReactMethod + public void getSdkVersion(Promise promise) { + try { + String res = AgoraManager.getInstance().mRtcEngine.getSdkVersion(); + promise.resolve(res); + } catch (Exception e) { + promise.reject(e); + } + } + + @ReactMethod + public void setVideoQualityParameters(boolean quality, Promise promise) { + try { + int res = AgoraManager.getInstance().mRtcEngine.setVideoQualityParameters(quality); + if (res != 0) throw new ReactNativeAgoraException("sendStreamMessage Failed", res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + map.putInt("value", res); + promise.resolve(map); + } catch (Exception e) { + promise.reject(e); + } + } + + @ReactMethod + public void setLocalVideoMirrorMode(int mode, Promise promise) { + try { + int res = AgoraManager.getInstance().mRtcEngine.setLocalVideoMirrorMode(mode); + if (res != 0) throw new ReactNativeAgoraException("setLocalVideoMirrorMode Failed", res); + WritableMap map = Arguments.createMap(); + map.putBoolean("success", true); + promise.resolve(map); + } catch (Exception e) { + promise.reject(e); + } } private void sendEvent(ReactContext reactContext, diff --git a/android/src/main/java/com/syan/agora/ConvertUtils.java b/android/src/main/java/com/syan/agora/ConvertUtils.java new file mode 100644 index 000000000..9f2737e34 --- /dev/null +++ b/android/src/main/java/com/syan/agora/ConvertUtils.java @@ -0,0 +1,298 @@ +package com.syan.agora; + +import android.support.annotation.Nullable; + +import com.facebook.react.bridge.Arguments; +import com.facebook.react.bridge.ReadableArray; +import com.facebook.react.bridge.ReadableMap; +import com.facebook.react.bridge.ReadableMapKeySetIterator; +import com.facebook.react.bridge.ReadableType; +import com.facebook.react.bridge.WritableArray; +import com.facebook.react.bridge.WritableMap; +import com.facebook.react.bridge.WritableNativeArray; +import com.facebook.react.bridge.WritableNativeMap; + +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +public class ConvertUtils { + public static Map readableMapToMap(final @Nullable ReadableMap readableMap) { + if (readableMap == null) { + return new HashMap<>(); + } + + final ReadableMapKeySetIterator iterator = readableMap.keySetIterator(); + if (!iterator.hasNextKey()) { + return new HashMap<>(); + } + + final Map result = new HashMap<>(); + while (iterator.hasNextKey()) { + final String key = iterator.nextKey(); + result.put(key, toObject(readableMap, key)); + } + + return result; + } + + public static Object toObject(@Nullable ReadableMap readableMap, String key) { + if (readableMap == null) { + return null; + } + + Object result; + + final ReadableType readableType = readableMap.getType(key); + switch (readableType) { + case Null: + result = key; + break; + case Boolean: + result = readableMap.getBoolean(key); + break; + case Number: + // Can be int or double. + double tmp = readableMap.getDouble(key); + if (tmp == (int) tmp) { + result = (int) tmp; + } else { + result = tmp; + } + break; + case String: + result = readableMap.getString(key); + break; + case Map: + result = readableMapToMap(readableMap.getMap(key)); + break; + case Array: + result = readableArrayToList(readableMap.getArray(key)); + break; + default: + throw new IllegalArgumentException("Could not convert object with key: " + key + "."); + } + + return result; + } + + /** + * toList converts a {@link ReadableArray} into an ArrayList. + * + * @param readableArray The ReadableArray to be conveted. + * @return An ArrayList containing the data that was in the ReadableArray. + */ + public static List readableArrayToList(final @Nullable ReadableArray readableArray) { + if (readableArray == null) { + return null; + } + + List result = new ArrayList<>(readableArray.size()); + for (int index = 0; index < readableArray.size(); index++) { + final ReadableType readableType = readableArray.getType(index); + switch (readableType) { + case Null: + result.add(String.valueOf(index)); + break; + case Boolean: + result.add(readableArray.getBoolean(index)); + break; + case Number: + // Can be int or double. + double tmp = readableArray.getDouble(index); + if (tmp == (int) tmp) { + result.add((int) tmp); + } else { + result.add(tmp); + } + break; + case String: + result.add(readableArray.getString(index)); + break; + case Map: + result.add(readableMapToMap(readableArray.getMap(index))); + break; + case Array: + result = readableArrayToList(readableArray.getArray(index)); + break; + default: + throw new IllegalArgumentException("Could not convert object with index: " + index + "."); + } + } + + return result; + } + + /** + * better + * + * @param jsonArray + * @return + * @throws JSONException + */ + public static WritableArray jsonToReact(final JSONArray jsonArray) throws JSONException { + final WritableArray writableArray = Arguments.createArray(); + for (int i = 0; i < jsonArray.length(); i++) { + final Object value = jsonArray.get(i); + if (value instanceof Float || value instanceof Double) { + writableArray.pushDouble(jsonArray.getDouble(i)); + } else if (value instanceof Number) { + writableArray.pushInt(jsonArray.getInt(i)); + } else if (value instanceof String) { + writableArray.pushString(jsonArray.getString(i)); + } else if (value instanceof Boolean) { + writableArray.pushBoolean(jsonArray.getBoolean(i)); + } else if (value instanceof JSONObject) { + writableArray.pushMap(jsonToReact(jsonArray.getJSONObject(i))); + } else if (value instanceof JSONArray) { + writableArray.pushArray(jsonToReact(jsonArray.getJSONArray(i))); + } else if (value == JSONObject.NULL) { + writableArray.pushNull(); + } + } + return writableArray; + } + + /** + * better + * + * @param jsonObject + * @return + * @throws JSONException + */ + public static WritableMap jsonToReact(final JSONObject jsonObject) throws JSONException { + final WritableMap writableMap = Arguments.createMap(); + final Iterator iterator = jsonObject.keys(); + while (iterator.hasNext()) { + final String key = (String) iterator.next(); + final Object value = jsonObject.get(key); + if (value instanceof Float || value instanceof Double) { + writableMap.putDouble(key, jsonObject.getDouble(key)); + } else if (value instanceof Number) { + writableMap.putInt(key, jsonObject.getInt(key)); + } else if (value instanceof String) { + writableMap.putString(key, jsonObject.getString(key)); + } else if (value instanceof JSONObject) { + writableMap.putMap(key, jsonToReact(jsonObject.getJSONObject(key))); + } else if (value instanceof JSONArray) { + writableMap.putArray(key, jsonToReact(jsonObject.getJSONArray(key))); + } else if (value instanceof Boolean) { + writableMap.putBoolean(key, jsonObject.getBoolean(key)); + } else if (value == JSONObject.NULL) { + writableMap.putNull(key); + } + } + return writableMap; + } + + public static WritableMap convertJsonToMap(JSONObject jsonObject) throws JSONException { + WritableMap map = new WritableNativeMap(); + + Iterator iterator = jsonObject.keys(); + while (iterator.hasNext()) { + String key = iterator.next(); + Object value = jsonObject.get(key); + if (value instanceof JSONObject) { + map.putMap(key, convertJsonToMap((JSONObject) value)); + } else if (value instanceof JSONArray) { + map.putArray(key, convertJsonToArray((JSONArray) value)); + } else if (value instanceof Boolean) { + map.putBoolean(key, (Boolean) value); + } else if (value instanceof Integer) { + map.putInt(key, (Integer) value); + } else if (value instanceof Double) { + map.putDouble(key, (Double) value); + } else if (value instanceof String) { + map.putString(key, (String) value); + } else { + map.putString(key, value.toString()); + } + } + return map; + } + + public static WritableArray convertJsonToArray(JSONArray jsonArray) throws JSONException { + WritableArray array = new WritableNativeArray(); + + for (int i = 0; i < jsonArray.length(); i++) { + Object value = jsonArray.get(i); + if (value instanceof JSONObject) { + array.pushMap(convertJsonToMap((JSONObject) value)); + } else if (value instanceof JSONArray) { + array.pushArray(convertJsonToArray((JSONArray) value)); + } else if (value instanceof Boolean) { + array.pushBoolean((Boolean) value); + } else if (value instanceof Integer) { + array.pushInt((Integer) value); + } else if (value instanceof Double) { + array.pushDouble((Double) value); + } else if (value instanceof String) { + array.pushString((String) value); + } else { + array.pushString(value.toString()); + } + } + return array; + } + + public static JSONObject convertMapToJson(ReadableMap readableMap) throws JSONException { + JSONObject object = new JSONObject(); + ReadableMapKeySetIterator iterator = readableMap.keySetIterator(); + while (iterator.hasNextKey()) { + String key = iterator.nextKey(); + switch (readableMap.getType(key)) { + case Null: + object.put(key, JSONObject.NULL); + break; + case Boolean: + object.put(key, readableMap.getBoolean(key)); + break; + case Number: + object.put(key, readableMap.getDouble(key)); + break; + case String: + object.put(key, readableMap.getString(key)); + break; + case Map: + object.put(key, convertMapToJson(readableMap.getMap(key))); + break; + case Array: + object.put(key, convertArrayToJson(readableMap.getArray(key))); + break; + } + } + return object; + } + + public static JSONArray convertArrayToJson(ReadableArray readableArray) throws JSONException { + JSONArray array = new JSONArray(); + for (int i = 0; i < readableArray.size(); i++) { + switch (readableArray.getType(i)) { + case Null: + break; + case Boolean: + array.put(readableArray.getBoolean(i)); + break; + case Number: + array.put(readableArray.getDouble(i)); + break; + case String: + array.put(readableArray.getString(i)); + break; + case Map: + array.put(convertMapToJson(readableArray.getMap(i))); + break; + case Array: + array.put(convertArrayToJson(readableArray.getArray(i))); + break; + } + } + return array; + } +} diff --git a/android/src/main/java/com/syan/agora/ReactNativeAgoraException.java b/android/src/main/java/com/syan/agora/ReactNativeAgoraException.java new file mode 100644 index 000000000..de64e71f1 --- /dev/null +++ b/android/src/main/java/com/syan/agora/ReactNativeAgoraException.java @@ -0,0 +1,19 @@ +package com.syan.agora; + + +import com.facebook.react.bridge.WritableMap; + +public class ReactNativeAgoraException extends Exception { + + private int code; + + public ReactNativeAgoraException(String message, final int code) { + super(message); + this.code = code; + } + + public int getCode() { + return this.code; + } + +} diff --git a/android/src/main/jniLibs/arm64-v8a/libagora-crypto.so b/android/src/main/jniLibs/arm64-v8a/libagora-crypto.so deleted file mode 100755 index 4219d1082..000000000 --- a/android/src/main/jniLibs/arm64-v8a/libagora-crypto.so +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:00adfb3f68244fedd280628b0cdf417c9a69440d6540d1c377eb37ceea846543 -size 2060784 diff --git a/android/src/main/jniLibs/arm64-v8a/libagora-rtc-sdk-jni.so b/android/src/main/jniLibs/arm64-v8a/libagora-rtc-sdk-jni.so deleted file mode 100755 index 10c1c5d38..000000000 --- a/android/src/main/jniLibs/arm64-v8a/libagora-rtc-sdk-jni.so +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:66b7e3c53fcc22924eec575d0d58cf8bbacb46a96a9072b981f1961844177850 -size 10738584 diff --git a/android/src/main/jniLibs/armeabi-v7a/libagora-crypto.so b/android/src/main/jniLibs/armeabi-v7a/libagora-crypto.so deleted file mode 100755 index 80ee6b11a..000000000 --- a/android/src/main/jniLibs/armeabi-v7a/libagora-crypto.so +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:777fd656f842dbcc210013c691457b4d316043a4bf810bdbf4dd76b437b11fd1 -size 1827952 diff --git a/android/src/main/jniLibs/armeabi-v7a/libagora-rtc-sdk-jni.so b/android/src/main/jniLibs/armeabi-v7a/libagora-rtc-sdk-jni.so deleted file mode 100755 index 8bb64b377..000000000 --- a/android/src/main/jniLibs/armeabi-v7a/libagora-rtc-sdk-jni.so +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:eabb164d93521798f5bc117b86723e063e4cbe6dd16362811b894e737dd3088a -size 7854896 diff --git a/android/src/main/jniLibs/include/IAgoraMediaEngine.h b/android/src/main/jniLibs/include/IAgoraMediaEngine.h deleted file mode 100755 index 265268c1e..000000000 --- a/android/src/main/jniLibs/include/IAgoraMediaEngine.h +++ /dev/null @@ -1,181 +0,0 @@ -#ifndef AGORA_MEDIA_ENGINE_H -#define AGORA_MEDIA_ENGINE_H -#if defined _WIN32 || defined __CYGWIN__ -typedef __int64 int64_t; -typedef unsigned __int64 uint64_t; -#else -#include -#endif - -namespace agora -{ -namespace media -{ - -enum MEDIA_SOURCE_TYPE { - AUDIO_PLAYOUT_SOURCE = 0, - AUDIO_RECORDING_SOURCE = 1, -}; - -class IAudioFrameObserver -{ -public: - enum AUDIO_FRAME_TYPE { - FRAME_TYPE_PCM16 = 0, //PCM 16bit little endian - }; - struct AudioFrame { - AUDIO_FRAME_TYPE type; - int samples; //number of samples in this frame - int bytesPerSample; //number of bytes per sample: 2 for PCM16 - int channels; //number of channels (data are interleaved if stereo) - int samplesPerSec; //sampling rate - void* buffer; //data buffer - int64_t renderTimeMs; - }; -public: - virtual bool onRecordAudioFrame(AudioFrame& audioFrame) = 0; - virtual bool onPlaybackAudioFrame(AudioFrame& audioFrame) = 0; - virtual bool onMixedAudioFrame(AudioFrame& audioFrame) = 0; - virtual bool onPlaybackAudioFrameBeforeMixing(unsigned int uid, AudioFrame& audioFrame) = 0; -}; - -class IVideoFrameObserver -{ -public: - enum VIDEO_FRAME_TYPE { - FRAME_TYPE_YUV420 = 0, //YUV 420 format - }; - struct VideoFrame { - VIDEO_FRAME_TYPE type; - int width; //width of video frame - int height; //height of video frame - int yStride; //stride of Y data buffer - int uStride; //stride of U data buffer - int vStride; //stride of V data buffer - void* yBuffer; //Y data buffer - void* uBuffer; //U data buffer - void* vBuffer; //V data buffer - int rotation; // rotation of this frame (0, 90, 180, 270) - int64_t renderTimeMs; - }; -public: - virtual bool onCaptureVideoFrame(VideoFrame& videoFrame) = 0; - virtual bool onRenderVideoFrame(unsigned int uid, VideoFrame& videoFrame) = 0; -}; - -class IVideoFrame -{ -public: - enum PLANE_TYPE { - Y_PLANE = 0, - U_PLANE = 1, - V_PLANE = 2, - NUM_OF_PLANES = 3 - }; - enum VIDEO_TYPE { - VIDEO_TYPE_UNKNOWN = 0, - VIDEO_TYPE_I420 = 1, - VIDEO_TYPE_IYUV = 2, - VIDEO_TYPE_RGB24 = 3, - VIDEO_TYPE_ABGR = 4, - VIDEO_TYPE_ARGB = 5, - VIDEO_TYPE_ARGB4444 = 6, - VIDEO_TYPE_RGB565 = 7, - VIDEO_TYPE_ARGB1555 = 8, - VIDEO_TYPE_YUY2 = 9, - VIDEO_TYPE_YV12 = 10, - VIDEO_TYPE_UYVY = 11, - VIDEO_TYPE_MJPG = 12, - VIDEO_TYPE_NV21 = 13, - VIDEO_TYPE_NV12 = 14, - VIDEO_TYPE_BGRA = 15, - VIDEO_TYPE_RGBA = 16, - }; - virtual void release() = 0; - virtual const unsigned char* buffer(PLANE_TYPE type) const = 0; - - // Copy frame: If required size is bigger than allocated one, new buffers of - // adequate size will be allocated. - // Return value: 0 on success ,-1 on error. - virtual int copyFrame(IVideoFrame** dest_frame) const = 0; - - // Convert frame - // Input: - // - src_frame : Reference to a source frame. - // - dst_video_type : Type of output video. - // - dst_sample_size : Required only for the parsing of MJPG. - // - dst_frame : Pointer to a destination frame. - // Return value: 0 if OK, < 0 otherwise. - // It is assumed that source and destination have equal height. - virtual int convertFrame(VIDEO_TYPE dst_video_type, int dst_sample_size, unsigned char* dst_frame) const = 0; - - // Get allocated size per plane. - virtual int allocated_size(PLANE_TYPE type) const = 0; - - // Get allocated stride per plane. - virtual int stride(PLANE_TYPE type) const = 0; - - // Get frame width. - virtual int width() const = 0; - - // Get frame height. - virtual int height() const = 0; - - // Get frame timestamp (90kHz). - virtual unsigned int timestamp() const = 0; - - // Get render time in milliseconds. - virtual int64_t render_time_ms() const = 0; - - // Return true if underlying plane buffers are of zero size, false if not. - virtual bool IsZeroSize() const = 0; -}; - -class IExternalVideoRenderCallback -{ -public: - virtual void onViewSizeChanged(int width, int height) = 0; - virtual void onViewDestroyed() = 0; -}; - -struct ExternalVideoRenerContext -{ - IExternalVideoRenderCallback* renderCallback; - void* view; - int renderMode; - int zOrder; - float left; - float top; - float right; - float bottom; -}; - -class IExternalVideoRender -{ -public: - virtual void release() = 0; - virtual int initialize() = 0; - virtual int deliverFrame(const IVideoFrame& videoFrame, int rotation, bool mirrored) = 0; -}; - -class IExternalVideoRenderFactory -{ -public: - virtual IExternalVideoRender* createRenderInstance(const ExternalVideoRenerContext& context) = 0; -}; - -class IMediaEngine -{ -public: - virtual void release() = 0; - virtual int registerAudioFrameObserver(IAudioFrameObserver* observer) = 0; - virtual int registerVideoFrameObserver(IVideoFrameObserver* observer) = 0; - virtual int registerVideoRenderFactory(IExternalVideoRenderFactory* factory) = 0; - virtual int pushAudioFrame(MEDIA_SOURCE_TYPE type, IAudioFrameObserver::AudioFrame *frame, bool wrap = false){ return -1; } -}; - -} //media - -} //agora - -#endif //AGORA_MEDIA_ENGINE_H diff --git a/android/src/main/jniLibs/include/IAgoraRtcEngine.h b/android/src/main/jniLibs/include/IAgoraRtcEngine.h deleted file mode 100755 index 3e2b617ed..000000000 --- a/android/src/main/jniLibs/include/IAgoraRtcEngine.h +++ /dev/null @@ -1,2255 +0,0 @@ -// -// Agora Rtc Engine SDK -// -// Created by Sting Feng in 2015-02. -// Copyright (c) 2015 Agora IO. All rights reserved. -// - -#ifndef AGORA_RTC_ENGINE_H -#define AGORA_RTC_ENGINE_H - -#include -#include -#include - -#if defined(_WIN32) -#define WIN32_LEAN_AND_MEAN -#include -#define AGORA_CALL __cdecl -#if defined(AGORARTC_EXPORT) -#define AGORA_API extern "C" __declspec(dllexport) -#else -#define AGORA_API extern "C" __declspec(dllimport) -#endif -#elif defined(__APPLE__) -#define AGORA_API __attribute__((visibility("default"))) extern "C" -#define AGORA_CALL -#elif defined(__ANDROID__) || defined(__linux__) -#define AGORA_API extern "C" __attribute__((visibility("default"))) -#define AGORA_CALL -#else -#define AGORA_API extern "C" -#define AGORA_CALL -#endif - -namespace agora { - namespace util { - -template -class AutoPtr { - typedef T value_type; - typedef T* pointer_type; -public: - AutoPtr(pointer_type p=0) - :ptr_(p) - {} - ~AutoPtr() { - if (ptr_) - ptr_->release(); - } - operator bool() const { return ptr_ != (pointer_type)0; } - value_type& operator*() const { - return *get(); - } - - pointer_type operator->() const { - return get(); - } - - pointer_type get() const { - return ptr_; - } - - pointer_type release() { - pointer_type tmp = ptr_; - ptr_ = 0; - return tmp; - } - - void reset(pointer_type ptr = 0) { - if (ptr != ptr_ && ptr_) - ptr_->release(); - ptr_ = ptr; - } - template - bool queryInterface(C1* c, C2 iid) { - pointer_type p = NULL; - if (c && !c->queryInterface(iid, (void**)&p)) - { - reset(p); - } - return p != NULL;; - } -private: - AutoPtr(const AutoPtr&); - AutoPtr& operator=(const AutoPtr&); -private: - pointer_type ptr_; -}; -class IString { -public: - virtual bool empty() const = 0; - virtual const char* c_str() = 0; - virtual const char* data() = 0; - virtual size_t length() = 0; - virtual void release() = 0; -}; -typedef AutoPtr AString; - - }//namespace util -namespace rtc { - typedef unsigned int uid_t; - typedef void* view_t; - -enum INTERFACE_ID_TYPE -{ - AGORA_IID_AUDIO_DEVICE_MANAGER = 1, - AGORA_IID_VIDEO_DEVICE_MANAGER = 2, - AGORA_IID_RTC_ENGINE_PARAMETER = 3, - AGORA_IID_MEDIA_ENGINE = 4, -}; - -enum WARN_CODE_TYPE -{ - WARN_INVALID_VIEW = 8, - WARN_INIT_VIDEO = 16, - WARN_PENDING = 20, - WARN_NO_AVAILABLE_CHANNEL = 103, - WARN_LOOKUP_CHANNEL_TIMEOUT = 104, - WARN_LOOKUP_CHANNEL_REJECTED = 105, - WARN_OPEN_CHANNEL_TIMEOUT = 106, - WARN_OPEN_CHANNEL_REJECTED = 107, - - // sdk: 100~1000 - WARN_SWITCH_LIVE_VIDEO_TIMEOUT = 111, - WARN_SET_CLIENT_ROLE_TIMEOUT = 118, - WARN_OPEN_CHANNEL_INVALID_TICKET = 121, - WARN_OPEN_CHANNEL_TRY_NEXT_VOS = 122, - WARN_AUDIO_MIXING_OPEN_ERROR = 701, - - WARN_ADM_RUNTIME_PLAYOUT_WARNING = 1014, - WARN_ADM_RUNTIME_RECORDING_WARNING = 1016, - WARN_ADM_RECORD_AUDIO_SILENCE = 1019, - WARN_ADM_PLAYOUT_MALFUNCTION = 1020, - WARN_ADM_RECORD_MALFUNCTION = 1021, - WARN_ADM_WIN_CORE_NO_RECORDING_DEVICE = 1322, - WARN_ADM_WIN_CORE_NO_PLAYOUT_DEVICE = 1323, - WARN_ADM_WIN_CORE_IMPROPER_CAPTURE_RELEASE = 1324, - WARN_ADM_RECORD_AUDIO_LOWLEVEL = 1031, - WARN_ADM_WINDOWS_NO_DATA_READY_EVENT = 1040, - WARN_APM_HOWLING = 1051, -}; - -enum ERROR_CODE_TYPE -{ - ERR_OK = 0, - //1~1000 - ERR_FAILED = 1, - ERR_INVALID_ARGUMENT = 2, - ERR_NOT_READY = 3, - ERR_NOT_SUPPORTED = 4, - ERR_REFUSED = 5, - ERR_BUFFER_TOO_SMALL = 6, - ERR_NOT_INITIALIZED = 7, - ERR_NO_PERMISSION = 9, - ERR_TIMEDOUT = 10, - ERR_CANCELED = 11, - ERR_TOO_OFTEN = 12, - ERR_BIND_SOCKET = 13, - ERR_NET_DOWN = 14, - ERR_NET_NOBUFS = 15, - ERR_JOIN_CHANNEL_REJECTED = 17, - ERR_LEAVE_CHANNEL_REJECTED = 18, - ERR_ALREADY_IN_USE = 19, - ERR_ABORTED = 20, - ERR_INIT_NET_ENGINE = 21, - ERR_INVALID_APP_ID = 101, - ERR_INVALID_CHANNEL_NAME = 102, - ERR_CHANNEL_KEY_EXPIRED = 109, - ERR_INVALID_CHANNEL_KEY = 110, - ERR_CONNECTION_INTERRUPTED = 111, // only used in web sdk - ERR_CONNECTION_LOST = 112, // only used in web sdk - ERR_DECRYPTION_FAILED = 120, - - ERR_NOT_IN_CHANNEL = 113, - ERR_SIZE_TOO_LARGE = 114, - ERR_BITRATE_LIMIT = 115, - ERR_TOO_MANY_DATA_STREAMS = 116, - ERR_STREAM_MESSAGE_TIMEOUT = 117, - ERR_SET_CLIENT_ROLE_NOT_AUTHORIZED = 119, - ERR_CLIENT_IS_BANNED_BY_SERVER = 123, - - //1001~2000 - ERR_LOAD_MEDIA_ENGINE = 1001, - ERR_START_CALL = 1002, - ERR_START_CAMERA = 1003, - ERR_START_VIDEO_RENDER = 1004, - ERR_ADM_GENERAL_ERROR = 1005, - ERR_ADM_JAVA_RESOURCE = 1006, - ERR_ADM_SAMPLE_RATE = 1007, - ERR_ADM_INIT_PLAYOUT = 1008, - ERR_ADM_START_PLAYOUT = 1009, - ERR_ADM_STOP_PLAYOUT = 1010, - ERR_ADM_INIT_RECORDING = 1011, - ERR_ADM_START_RECORDING = 1012, - ERR_ADM_STOP_RECORDING = 1013, - ERR_ADM_RUNTIME_PLAYOUT_ERROR = 1015, - ERR_ADM_RUNTIME_RECORDING_ERROR = 1017, - ERR_ADM_RECORD_AUDIO_FAILED = 1018, - ERR_ADM_INIT_LOOPBACK = 1022, - ERR_ADM_START_LOOPBACK = 1023, - ERR_ADM_NO_PERMISSION = 1027, - // 1025, as warning for interruption of adm on ios - // 1026, as warning for route change of adm on ios - ERR_ADM_ANDROID_JNI_JAVA_RECORD_ERROR = 1115, - - // VDM error code starts from 1500 - ERR_VDM_CAMERA_NOT_AUTHORIZED = 1501, - - // VCM error code starts from 1600 - ERR_VCM_UNKNOWN_ERROR = 1600, - ERR_VCM_ENCODER_INIT_ERROR = 1601, - ERR_VCM_ENCODER_ENCODE_ERROR = 1602, - ERR_VCM_ENCODER_SET_ERROR = 1603, -}; - -enum LOG_FILTER_TYPE -{ - LOG_FILTER_OFF = 0, - LOG_FILTER_DEBUG = 0x080f, - LOG_FILTER_INFO = 0x000f, - LOG_FILTER_WARN = 0x000e, - LOG_FILTER_ERROR = 0x000c, - LOG_FILTER_CRITICAL = 0x0008, - LOG_FILTER_MASK = 0x80f, -}; - -enum MAX_DEVICE_ID_LENGTH_TYPE -{ - MAX_DEVICE_ID_LENGTH = 512 -}; - -enum QUALITY_REPORT_FORMAT_TYPE -{ - QUALITY_REPORT_JSON = 0, - QUALITY_REPORT_HTML = 1, -}; - -enum MEDIA_ENGINE_EVENT_CODE_TYPE -{ - MEDIA_ENGINE_RECORDING_ERROR = 0, - MEDIA_ENGINE_PLAYOUT_ERROR = 1, - MEDIA_ENGINE_RECORDING_WARNING = 2, - MEDIA_ENGINE_PLAYOUT_WARNING = 3, - MEDIA_ENGINE_AUDIO_FILE_MIX_FINISH = 10, - MEDIA_ENGINE_AUDIO_FAREND_MUSIC_BEGINS = 12, - MEDIA_ENGINE_AUDIO_FAREND_MUSIC_ENDS = 13, - // media engine role changed - MEDIA_ENGINE_ROLE_BROADCASTER_SOLO = 20, - MEDIA_ENGINE_ROLE_BROADCASTER_INTERACTIVE = 21, - MEDIA_ENGINE_ROLE_AUDIENCE = 22, - MEDIA_ENGINE_ROLE_COMM_PEER = 23, - MEDIA_ENGINE_ROLE_GAME_PEER = 24, - // iOS adm sample rate changed - MEDIA_ENGINE_AUDIO_ADM_REQUIRE_RESTART = 110, - MEDIA_ENGINE_AUDIO_ADM_SPECIAL_RESTART = 111, - // iOS keep AVAudioSession settings - MEDIA_ENGINE_AUDIO_KEEP_SESSION_CONFIG = 120 -}; - -enum MEDIA_DEVICE_STATE_TYPE -{ - MEDIA_DEVICE_STATE_ACTIVE = 1, - MEDIA_DEVICE_STATE_DISABLED = 2, - MEDIA_DEVICE_STATE_NOT_PRESENT = 4, - MEDIA_DEVICE_STATE_UNPLUGGED = 8 -}; - -enum MEDIA_DEVICE_TYPE -{ - UNKNOWN_AUDIO_DEVICE = -1, - AUDIO_PLAYOUT_DEVICE = 0, - AUDIO_RECORDING_DEVICE = 1, - VIDEO_RENDER_DEVICE = 2, - VIDEO_CAPTURE_DEVICE = 3, - AUDIO_APPLICATION_PLAYOUT_DEVICE = 4, -}; - -enum AUDIO_RECORDING_QUALITY_TYPE -{ - AUDIO_RECORDING_QUALITY_LOW = 0, - AUDIO_RECORDING_QUALITY_MEDIUM = 1, - AUDIO_RECORDING_QUALITY_HIGH = 2, -}; - -enum QUALITY_TYPE -{ - QUALITY_UNKNOWN = 0, - QUALITY_EXCELLENT = 1, - QUALITY_GOOD = 2, - QUALITY_POOR = 3, - QUALITY_BAD = 4, - QUALITY_VBAD = 5, - QUALITY_DOWN = 6, -}; - -enum RENDER_MODE_TYPE -{ - RENDER_MODE_HIDDEN = 1, - RENDER_MODE_FIT = 2, - RENDER_MODE_ADAPTIVE = 3, -}; - -enum VIDEO_MIRROR_MODE_TYPE -{ - VIDEO_MIRROR_MODE_AUTO = 0,//determined by SDK - VIDEO_MIRROR_MODE_ENABLED = 1,//enabled mirror - VIDEO_MIRROR_MODE_DISABLED = 2,//disable mirror -}; - -enum VIDEO_PROFILE_TYPE -{ // res fps kbps - VIDEO_PROFILE_120P = 0, // 160x120 15 65 - VIDEO_PROFILE_120P_3 = 2, // 120x120 15 50 - VIDEO_PROFILE_180P = 10, // 320x180 15 140 - VIDEO_PROFILE_180P_3 = 12, // 180x180 15 100 - VIDEO_PROFILE_180P_4 = 13, // 240x180 15 120 - VIDEO_PROFILE_240P = 20, // 320x240 15 200 - VIDEO_PROFILE_240P_3 = 22, // 240x240 15 140 - VIDEO_PROFILE_240P_4 = 23, // 424x240 15 220 - VIDEO_PROFILE_360P = 30, // 640x360 15 400 - VIDEO_PROFILE_360P_3 = 32, // 360x360 15 260 - VIDEO_PROFILE_360P_4 = 33, // 640x360 30 600 - VIDEO_PROFILE_360P_6 = 35, // 360x360 30 400 - VIDEO_PROFILE_360P_7 = 36, // 480x360 15 320 - VIDEO_PROFILE_360P_8 = 37, // 480x360 30 490 - VIDEO_PROFILE_360P_9 = 38, // 640x360 15 800 - VIDEO_PROFILE_360P_10 = 39, // 640x360 24 800 - VIDEO_PROFILE_360P_11 = 100, // 640x360 24 1000 - VIDEO_PROFILE_480P = 40, // 640x480 15 500 - VIDEO_PROFILE_480P_3 = 42, // 480x480 15 400 - VIDEO_PROFILE_480P_4 = 43, // 640x480 30 750 - VIDEO_PROFILE_480P_6 = 45, // 480x480 30 600 - VIDEO_PROFILE_480P_8 = 47, // 848x480 15 610 - VIDEO_PROFILE_480P_9 = 48, // 848x480 30 930 - VIDEO_PROFILE_480P_10 = 49, // 640x480 10 400 - VIDEO_PROFILE_720P = 50, // 1280x720 15 1130 - VIDEO_PROFILE_720P_3 = 52, // 1280x720 30 1710 - VIDEO_PROFILE_720P_5 = 54, // 960x720 15 910 - VIDEO_PROFILE_720P_6 = 55, // 960x720 30 1380 - VIDEO_PROFILE_1080P = 60, // 1920x1080 15 2080 - VIDEO_PROFILE_1080P_3 = 62, // 1920x1080 30 3150 - VIDEO_PROFILE_1080P_5 = 64, // 1920x1080 60 4780 - VIDEO_PROFILE_1440P = 66, // 2560x1440 30 4850 - VIDEO_PROFILE_1440P_2 = 67, // 2560x1440 60 7350 - VIDEO_PROFILE_4K = 70, // 3840x2160 30 8910 - VIDEO_PROFILE_4K_3 = 72, // 3840x2160 60 13500 - VIDEO_PROFILE_DEFAULT = VIDEO_PROFILE_360P, -}; - -enum AUDIO_PROFILE_TYPE // sample rate, bit rate, mono/stereo, speech/music codec -{ - AUDIO_PROFILE_DEFAULT = 0, // use default settings - AUDIO_PROFILE_SPEECH_STANDARD = 1, // 32Khz, 18kbps, mono, speech - AUDIO_PROFILE_MUSIC_STANDARD = 2, // 48Khz, 50kbps, mono, music - AUDIO_PROFILE_MUSIC_STANDARD_STEREO = 3, // 48Khz, 50kbps, stereo, music - AUDIO_PROFILE_MUSIC_HIGH_QUALITY = 4, // 48Khz, 128kbps, mono, music - AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO = 5, // 48Khz, 128kbps, stereo, music - AUDIO_PROFILE_NUM = 6, -}; - -enum AUDIO_SCENARIO_TYPE // set a suitable scenario for your app type -{ - AUDIO_SCENARIO_DEFAULT = 0, - AUDIO_SCENARIO_CHATROOM = 1, - AUDIO_SCENARIO_EDUCATION = 2, - AUDIO_SCENARIO_GAME_STREAMING = 3, - AUDIO_SCENARIO_SHOWROOM = 4, - AUDIO_SCENARIO_NUM = 5, -}; - -enum CHANNEL_PROFILE_TYPE -{ - CHANNEL_PROFILE_COMMUNICATION = 0, - CHANNEL_PROFILE_LIVE_BROADCASTING = 1, - CHANNEL_PROFILE_GAME = 2, -}; - -enum CLIENT_ROLE_TYPE -{ - CLIENT_ROLE_BROADCASTER = 1, - CLIENT_ROLE_AUDIENCE = 2, -}; - -enum USER_OFFLINE_REASON_TYPE -{ - USER_OFFLINE_QUIT = 0, - USER_OFFLINE_DROPPED = 1, - USER_OFFLINE_BECOME_AUDIENCE = 2, -}; - -enum REMOTE_VIDEO_STREAM_TYPE -{ - REMOTE_VIDEO_STREAM_HIGH = 0, - REMOTE_VIDEO_STREAM_LOW = 1, -}; - -enum RAW_AUDIO_FRAME_OP_MODE_TYPE -{ - RAW_AUDIO_FRAME_OP_MODE_READ_ONLY = 0, - RAW_AUDIO_FRAME_OP_MODE_WRITE_ONLY = 1, - RAW_AUDIO_FRAME_OP_MODE_READ_WRITE = 2, -}; - -struct AudioVolumeInfo -{ - uid_t uid; - unsigned int volume; // [0,255] -}; - -struct RtcStats -{ - unsigned int duration; - unsigned int txBytes; - unsigned int rxBytes; - unsigned short txKBitRate; - unsigned short rxKBitRate; - - unsigned short rxAudioKBitRate; - unsigned short txAudioKBitRate; - - unsigned short rxVideoKBitRate; - unsigned short txVideoKBitRate; - unsigned int users; - double cpuAppUsage; - double cpuTotalUsage; -}; - -struct LocalVideoStats -{ - int sentBitrate; - int sentFrameRate; -}; - -struct RemoteVideoStats -{ - uid_t uid; - int delay; - int width; - int height; - int receivedBitrate; - int receivedFrameRate; - REMOTE_VIDEO_STREAM_TYPE rxStreamType; -}; - -struct VideoCompositingLayout -{ - struct Region { - uid_t uid; - double x;//[0,1] - double y;//[0,1] - double width;//[0,1] - double height;//[0,1] - int zOrder; //optional, [0, 100] //0 (default): bottom most, 100: top most - - // Optional - // [0, 1.0] where 0 denotes throughly transparent, 1.0 opaque - double alpha; - - RENDER_MODE_TYPE renderMode;//RENDER_MODE_HIDDEN: Crop, RENDER_MODE_FIT: Zoom to fit - Region() - :uid(0) - , x(0) - , y(0) - , width(0) - , height(0) - , zOrder(0) - , alpha(1.0) - , renderMode(RENDER_MODE_HIDDEN) - {} - - }; - int canvasWidth; - int canvasHeight; - const char* backgroundColor;//e.g. "#C0C0C0" in RGB - const Region* regions; - int regionCount; - const char* appData; - int appDataLength; - VideoCompositingLayout() - :canvasWidth(0) - ,canvasHeight(0) - ,backgroundColor(NULL) - ,regions(NULL) - , regionCount(0) - , appData(NULL) - , appDataLength(0) - {} -}; - -typedef struct Rect { - int top; - int left; - int bottom; - int right; - - Rect(): top(0), left(0), bottom(0), right(0) {} - Rect(int t, int l, int b, int r): top(t), left(l), bottom(b), right(r) {} -} Rect; - -#if defined(_WIN32) - -enum RTMP_STREAM_LIFE_CYCLE_TYPE -{ - RTMP_STREAM_LIFE_CYCLE_BIND2CHANNEL = 1, - RTMP_STREAM_LIFE_CYCLE_BIND2OWNER = 2, -}; - -struct PublisherConfiguration { - int width; - int height; - int framerate; - int bitrate; - int defaultLayout; - int lifecycle; - bool owner; - int injectStreamWidth; - int injectStreamHeight; - const char* injectStreamUrl; - const char* publishUrl; - const char* rawStreamUrl; - const char* extraInfo; - - - PublisherConfiguration() - : width(640) - , height(360) - , framerate(15) - , bitrate(500) - , defaultLayout(1) - , lifecycle(RTMP_STREAM_LIFE_CYCLE_BIND2CHANNEL) - , owner(true) - , injectStreamWidth(0) - , injectStreamHeight(0) - , injectStreamUrl(NULL) - , publishUrl(NULL) - , rawStreamUrl(NULL) - , extraInfo(NULL) - {} - -}; -#endif -#if !defined(__ANDROID__) -struct VideoCanvas -{ - view_t view; - int renderMode; - uid_t uid; - void *priv; // private data (underlying video engine denotes it) - - VideoCanvas() - : view(NULL) - , renderMode(RENDER_MODE_HIDDEN) - , uid(0) - , priv(NULL) - {} - VideoCanvas(view_t v, int m, uid_t u) - : view(v) - , renderMode(m) - , uid(u) - , priv(NULL) - {} -}; -#else -struct VideoCanvas; -#endif - -class IPacketObserver -{ -public: - - struct Packet - { - const unsigned char* buffer; - unsigned int size; - }; - /** - * called by sdk before the audio packet is sent to other participants - * @param [in,out] packet - * buffer *buffer points the data to be sent - * size of buffer data to be sent - * @return returns true to send out the packet, returns false to discard the packet - */ - virtual bool onSendAudioPacket(Packet& packet) = 0; - /** - * called by sdk before the video packet is sent to other participants - * @param [in,out] packet - * buffer *buffer points the data to be sent - * size of buffer data to be sent - * @return returns true to send out the packet, returns false to discard the packet - */ - virtual bool onSendVideoPacket(Packet& packet) = 0; - /** - * called by sdk when the audio packet is received from other participants - * @param [in,out] packet - * buffer *buffer points the data to be sent - * size of buffer data to be sent - * @return returns true to process the packet, returns false to discard the packet - */ - virtual bool onReceiveAudioPacket(Packet& packet) = 0; - /** - * called by sdk when the video packet is received from other participants - * @param [in,out] packet - * buffer *buffer points the data to be sent - * size of buffer data to be sent - * @return returns true to process the packet, returns false to discard the packet - */ - virtual bool onReceiveVideoPacket(Packet& packet) = 0; -}; - - -/** -* the event call back interface -*/ -class IRtcEngineEventHandler -{ -public: - virtual ~IRtcEngineEventHandler() {} - - /** - * when join channel success, the function will be called - * @param [in] channel - * the channel name you have joined - * @param [in] uid - * the UID of you in this channel - * @param [in] elapsed - * the time elapsed in ms from the joinChannel been called to joining completed - */ - virtual void onJoinChannelSuccess(const char* channel, uid_t uid, int elapsed) { - (void)channel; - (void)uid; - (void)elapsed; - } - - /** - * when join channel success, the function will be called - * @param [in] channel - * the channel name you have joined - * @param [in] uid - * the UID of you in this channel - * @param [in] elapsed - * the time elapsed in ms elapsed - */ - virtual void onRejoinChannelSuccess(const char* channel, uid_t uid, int elapsed) { - (void)channel; - (void)uid; - (void)elapsed; - } - - /** - * when warning message coming, the function will be called - * @param [in] warn - * warning code - * @param [in] msg - * the warning message - */ - virtual void onWarning(int warn, const char* msg) { - (void)warn; - (void)msg; - } - - /** - * when error message come, the function will be called - * @param [in] err - * error code - * @param [in] msg - * the error message - */ - virtual void onError(int err, const char* msg) { - (void)err; - (void)msg; - } - - /** - * when audio quality message come, the function will be called - * @param [in] uid - * the uid of the peer - * @param [in] quality - * the quality of the user, see QUALITY_TYPE for value definition - * @param [in] delay - * the average time of the audio packages delayed - * @param [in] lost - * the rate of the audio packages lost - */ - virtual void onAudioQuality(uid_t uid, int quality, unsigned short delay, unsigned short lost) { - (void)uid; - (void)quality; - (void)delay; - (void)lost; - } - - /** - * when the audio volume information come, the function will be called - * @param [in] speakers - * the array of the speakers' audio volume information - * @param [in] speakerNumber - * the count of speakers in this array - * @param [in] totalVolume - * the total volume of all users - */ - virtual void onAudioVolumeIndication(const AudioVolumeInfo* speakers, unsigned int speakerNumber, int totalVolume) { - (void)speakers; - (void)speakerNumber; - (void)totalVolume; - } - - /** - * when the audio volume information come, the function will be called - * @param [in] stats - * the statistics of the call - */ - virtual void onLeaveChannel(const RtcStats& stats) { - (void)stats; - } - - /** - * when the information of the RTC engine stats come, the function will be called - * @param [in] stats - * the RTC engine stats - */ - virtual void onRtcStats(const RtcStats& stats) { - (void)stats; - } - - /** - * when the audio device state changed(plugged or removed), the function will be called - * @param [in] deviceId - * the ID of the state changed audio device - * @param [in] deviceType - * the type of the audio device(playout device or record device) - * @param [in] deviceState - * the device is been removed or added - */ - virtual void onAudioDeviceStateChanged(const char* deviceId, int deviceType, int deviceState) { - (void)deviceId; - (void)deviceType; - (void)deviceState; - } - - /** - * When audio mixing file playback finished, this function will be called - */ - virtual void onAudioMixingFinished() { - } - - /** - * When far-end rhythm begins/ends, these functions will be called - */ - virtual void onRemoteAudioMixingBegin() { - } - virtual void onRemoteAudioMixingEnd() { - } - - /** - * When audio effect playback finished, this function will be called - */ - virtual void onAudioEffectFinished(int soundId) { - } - - /** - * when the video device state changed(plugged or removed), the function will be called - * @param [in] deviceId - * the ID of the state changed video device - * @param [in] deviceType - * not used - * @param [in] deviceState - * the device is been removed or added - */ - virtual void onVideoDeviceStateChanged(const char* deviceId, int deviceType, int deviceState) { - (void)deviceId; - (void)deviceType; - (void)deviceState; - } - - /** - * report the network quality - * @param [in] uid - * the UID of the remote user - * @param [in] txQuality - * the score of the send network quality 0~5 the higher the better - * @param [in] rxQuality - * the score of the recv network quality 0~5 the higher the better - */ - virtual void onNetworkQuality(uid_t uid, int txQuality, int rxQuality) { - (void)uid; - (void)txQuality; - (void)rxQuality; - } - - /** - * report the last-mile test network quality - * @param [in] quality - * the score of the network quality 0~5 the higher the better - */ - virtual void onLastmileQuality(int quality) { - (void)quality; - } - - /** - * when the first local video frame displayed, the function will be called - * @param [in] width - * the width of the video frame - * @param [in] height - * the height of the video frame - * @param [in] elapsed - * the time elapsed from channel joined in ms - */ - virtual void onFirstLocalVideoFrame(int width, int height, int elapsed) { - (void)width; - (void)height; - (void)elapsed; - } - - /** - * when the first remote video frame decoded, the function will be called - * @param [in] uid - * the UID of the remote user - * @param [in] width - * the width of the video frame - * @param [in] height - * the height of the video frame - * @param [in] elapsed - * the time elapsed from channel joined in ms - */ - virtual void onFirstRemoteVideoDecoded(uid_t uid, int width, int height, int elapsed) { - (void)uid; - (void)width; - (void)height; - (void)elapsed; - } - - /** - * when video size changed or rotation changed, the function will be called - * @param [in] uid - * the UID of the remote user or local user (0) - * @param [in] width - * the new width of the video - * @param [in] height - * the new height of the video - * @param [in] rotation - * the rotation of the video - */ - virtual void onVideoSizeChanged(uid_t uid, int width, int height, int rotation) { - (void)uid; - (void)width; - (void)height; - (void)rotation; - } - - /** - * when the first remote video frame displayed, the function will be called - * @param [in] uid - * the UID of the remote user - * @param [in] width - * the width of the video frame - * @param [in] height - * the height of the video frame - * @param [in] elapsed - * the time elapsed from remote user called joinChannel in ms - */ - virtual void onFirstRemoteVideoFrame(uid_t uid, int width, int height, int elapsed) { - (void)uid; - (void)width; - (void)height; - (void)elapsed; - } - - /** - * when any other user joined in the same channel, the function will be called - * @param [in] uid - * the UID of the remote user - * @param [in] elapsed - * the time elapsed from remote used called joinChannel to joining completed in ms - */ - virtual void onUserJoined(uid_t uid, int elapsed) { - (void)uid; - (void)elapsed; - } - - /** - * when user offline(exit channel or offline by accident), the function will be called - * @param [in] uid - * the UID of the remote user - */ - virtual void onUserOffline(uid_t uid, USER_OFFLINE_REASON_TYPE reason) { - (void)uid; - (void)reason; - } - - /** - * when remote user muted the audio stream, the function will be called - * @param [in] uid - * the UID of the remote user - * @param [in] muted - * true: the remote user muted the audio stream, false: the remote user unmuted the audio stream - */ - virtual void onUserMuteAudio(uid_t uid, bool muted) { - (void)uid; - (void)muted; - } - - /** - * when remote user muted the video stream, the function will be called - * @param [in] uid - * the UID of the remote user - * @param [in] muted - * true: the remote user muted the video stream, false: the remote user unmuted the video stream - */ - virtual void onUserMuteVideo(uid_t uid, bool muted) { - (void)uid; - (void)muted; - } - - /** - * when remote user enable video function, the function will be called - * @param [in] uid - * the UID of the remote user - * @param [in] enabled - * true: the remote user has enabled video function, false: the remote user has disabled video function - */ - virtual void onUserEnableVideo(uid_t uid, bool enabled) { - (void)uid; - (void)enabled; - } - - /** - * when remote user enable local video function, the function will be called - * @param [in] uid - * the UID of the remote user - * @param [in] enabled - * true: the remote user has enabled local video function, false: the remote user has disabled local video function - */ - virtual void onUserEnableLocalVideo(uid_t uid, bool enabled) { - (void)uid; - (void)enabled; - } - - /** - * when api call executed completely, the function will be called - * @param [in] api - * the api name - * @param [in] error - * error code while 0 means OK - */ - virtual void onApiCallExecuted(const char* api, int error) { - (void)api; - (void)error; - } - - /** - * reported local video stats - * @param [in] stats - * the latest local video stats - */ - virtual void onLocalVideoStats(const LocalVideoStats& stats) { - (void)stats; - } - - /** - * reported remote video stats - * @param [in] stats - * the latest remote video stats - */ - virtual void onRemoteVideoStats(const RemoteVideoStats& stats) { - (void)stats; - } - - /** - * when the camera is ready to work, the function will be called - */ - virtual void onCameraReady() {} - - /** - * when all video stopped, the function will be called then you can repaint the video windows - */ - virtual void onVideoStopped() {} - - /** - * when the network can not worked well, the function will be called - */ - virtual void onConnectionLost() {} - - /** - * when local user disconnected by accident, the function will be called(then SDK will try to reconnect itself) - */ - virtual void onConnectionInterrupted() {} - - /** - * when local user is banned by the server, the function will be called - */ - virtual void onConnectionBanned() {} - - virtual void onRefreshRecordingServiceStatus(int status) { - (void)status; - } - -// virtual void onStreamError(int streamId, int code, int parameter, const char* message, size_t length) {} - /** - * when stream message received, the function will be called - * @param [in] uid - * UID of the peer who sends the message - * @param [in] streamId - * APP can create multiple streams for sending messages of different purposes - * @param [in] data - * the message data - * @param [in] length - * the message length, in bytes - * frame rate - */ - virtual void onStreamMessage(uid_t uid, int streamId, const char* data, size_t length) { - (void)uid; - (void)streamId; - (void)data; - (void)length; - } - - /** - * - */ - virtual void onStreamMessageError(uid_t uid, int streamId, int code, int missed, int cached) { - (void)uid; - (void)streamId; - (void)code; - (void)missed; - (void)cached; - } - - virtual void onMediaEngineLoadSuccess() { - } - virtual void onMediaEngineStartCallSuccess() { - } - /** - * when channel key is enabled, and specified channel key is invalid or expired, this function will be called. - * APP should generate a new channel key and call renewChannelKey() to refresh the key. - * NOTE: to be compatible with previous version, ERR_CHANNEL_KEY_EXPIRED and ERR_INVALID_CHANNEL_KEY are also reported via onError() callback. - * You should move renew of channel key logic into this callback. - */ - virtual void onRequestChannelKey() { - } - - /** - * when the first local audio frame generated, the function will be called - * @param [in] elapsed - * the time elapsed from remote user called joinChannel in ms - */ - virtual void onFirstLocalAudioFrame(int elapsed) { - (void)elapsed; - } - - /** - * when the first remote audio frame arrived, the function will be called - * @param [in] uid - * the UID of the remote user - * @param [in] elapsed - * the time elapsed from remote user called joinChannel in ms - */ - virtual void onFirstRemoteAudioFrame(uid_t uid, int elapsed) { - (void)uid; - (void)elapsed; - } - /** @param [in] uid - * the speaker uid who is talking in the channel - */ - virtual void onActiveSpeaker(uid_t uid) { - (void)uid; - } - - /** - * when client role is successfully changed, the function will be called - */ - virtual void onClientRoleChanged(CLIENT_ROLE_TYPE oldRole, CLIENT_ROLE_TYPE newRole) { - } - - virtual void onAudioDeviceVolumeChanged(MEDIA_DEVICE_TYPE deviceType, int volume, bool muted) { - (void)deviceType; - (void)volume; - (void)muted; - } -}; - -/** -* the video device collection interface -*/ -class IVideoDeviceCollection -{ -public: - /** - * get the audio device count - * @return returns the audio device count - */ - virtual int getCount() = 0; - - /** - * get audio device information - * @param [in] index - * the index of the device in the device list - * @param [in, out] deviceName - * the device name, UTF8 format - * @param [in, out] deviceId - * the device ID, UTF8 format - * @return return 0 if success or an error code - */ - virtual int getDevice(int index, char deviceName[MAX_DEVICE_ID_LENGTH], char deviceId[MAX_DEVICE_ID_LENGTH]) = 0; - - /** - * set current active audio device - * @param [in] deviceId - * the deviceId of the device you want to active currently - * @return return 0 if success or an error code - */ - virtual int setDevice(const char deviceId[MAX_DEVICE_ID_LENGTH]) = 0; - - /** - * release the resource - */ - virtual void release() = 0; -}; - -class IVideoDeviceManager -{ -public: - - /** - * create the IVideoDeviceCollection interface pointer - * @return return the IVideoDeviceCollection interface or nullptr if failed - */ - virtual IVideoDeviceCollection* enumerateVideoDevices() = 0; - - /** - * active the video device for current using - * @param [in] deviceId - * the deviceId of the device you want to active currently - * @return return 0 if success or the error code. - */ - virtual int setDevice(const char deviceId[MAX_DEVICE_ID_LENGTH]) = 0; - - /** - * get the current active video device - * @param [in, out] deviceId - * the device id of the current active video device - * @return return 0 if success or an error code - */ - virtual int getDevice(char deviceId[MAX_DEVICE_ID_LENGTH]) = 0; - - /** - * test the video capture device to know whether it can worked well - * @param [in] hwnd - * the HWND of the video-display window - * @return return 0 if success or an error code - */ - virtual int startDeviceTest(view_t hwnd) = 0; - - /** - * stop the video device testing - * @return return 0 if success or an error code - */ - virtual int stopDeviceTest() = 0; - - /** - * release the resource - */ - virtual void release() = 0; -}; - -class IAudioDeviceCollection -{ -public: - /** - * get the available devices count - * @return return the device count - */ - virtual int getCount() = 0; - - /** - * get video device information - * @param [in] index - * the index of the device in the device list - * @param [in, out] deviceName - * the device name, UTF8 format - * @param [in, out] deviceId - * the device ID, UTF8 format - * @return return 0 if success or an error code - */ - virtual int getDevice(int index, char deviceName[MAX_DEVICE_ID_LENGTH], char deviceId[MAX_DEVICE_ID_LENGTH]) = 0; - - /** - * active the device for current using - * @param [in] deviceId - * the deviceId of the device you want to active currently - * @return return 0 if success or the error code. - */ - virtual int setDevice(const char deviceId[MAX_DEVICE_ID_LENGTH]) = 0; - - virtual int setApplicationVolume(int volume) = 0; - virtual int getApplicationVolume(int& volume) = 0; - virtual int setApplicationMute(bool mute) = 0; - virtual int isApplicationMute(bool& mute) = 0; - /** - * release the resource - */ - virtual void release() = 0; -}; - -class IAudioDeviceManager -{ -public: - /** - * create the IAudioDeviceCollection interface pointer of the playback devices - * @return return the IVideoDeviceCollection interface or nullptr if failed - */ - virtual IAudioDeviceCollection* enumeratePlaybackDevices() = 0; - - /** - * create the IAudioDeviceCollection interface pointer of the Recording devices - * @return return the IVideoDeviceCollection interface or nullptr if failed - */ - virtual IAudioDeviceCollection* enumerateRecordingDevices() = 0; - - /** - * active the playback device for current using - * @param [in] deviceId - * the deviceId of the playback device you want to active currently - * @return return 0 if success or the error code. - */ - virtual int setPlaybackDevice(const char deviceId[MAX_DEVICE_ID_LENGTH]) = 0; - - /** - * get the current active playback device - * @param [in, out] deviceId - * the device id of the current active video device - * @return return 0 if success or an error code - */ - virtual int getPlaybackDevice(char deviceId[MAX_DEVICE_ID_LENGTH]) = 0; - - /** - * set current playback device volume - * @param [in] volume - * the volume you want to set 0-255 - * @return return 0 if success or an error code - */ - virtual int setPlaybackDeviceVolume(int volume) = 0; - - /** - * get current playback device volume - * @param [in, out] volume - * the current playback device volume 0-255 - * @return return 0 if success or an error code - */ - virtual int getPlaybackDeviceVolume(int *volume) = 0; - - /** - * active the recording audio device for current using - * @param [in] deviceId - * the deviceId of the recording audio device you want to active currently - * @return return 0 if success or the error code. - */ - virtual int setRecordingDevice(const char deviceId[MAX_DEVICE_ID_LENGTH]) = 0; - - /** - * get the current active recording device - * @param [in, out] deviceId - * the device id of the current active recording audio device - * @return return 0 if success or an error code - */ - virtual int getRecordingDevice(char deviceId[MAX_DEVICE_ID_LENGTH]) = 0; - - /** - * set current recording device volume - * @param [in] volume - * the volume you want to set 0-255 - * @return return 0 if success or an error code - */ - virtual int setRecordingDeviceVolume(int volume) = 0; - - /** - * get current recording device volume - * @param [in, out] volume - * the current recording device volume 0-255 - * @return return 0 if success or an error code - */ - virtual int getRecordingDeviceVolume(int *volume) = 0; - - virtual int setPlaybackDeviceMute(bool mute) = 0; - virtual int getPlaybackDeviceMute(bool *mute) = 0; - virtual int setRecordingDeviceMute(bool mute) = 0; - virtual int getRecordingDeviceMute(bool *mute) = 0; - - /** - * test the playback audio device to know whether it can worked well - * @param [in] testAudioFilePath - * the path of the .wav file - * @return return 0 if success and you can hear the sound of the .wav file or an error code. - */ - virtual int startPlaybackDeviceTest(const char* testAudioFilePath) = 0; - - /** - * stop the playback audio device testing - * @return return 0 if success or an error code - */ - virtual int stopPlaybackDeviceTest() = 0; - - /** - * test the recording audio device to know whether it can worked well - * @param [in] indicationInterval - * the period in ms of the call back cycle - * @return return 0 if success or an error code - */ - virtual int startRecordingDeviceTest(int indicationInterval) = 0; - - /** - * stop the recording audio device testing - * @return return 0 if success or an error code - */ - virtual int stopRecordingDeviceTest() = 0; - - /** - * release the resource - */ - virtual void release() = 0; -}; - -struct RtcEngineContext -{ - IRtcEngineEventHandler* eventHandler; - const char* appId; - RtcEngineContext() - :eventHandler(NULL) - ,appId(NULL) - {} -}; - - -class IRtcEngine -{ -public: - /** - * release the engine resource - * @param [in] sync - * true: release the engine resources and return after all resources have been destroyed. - * APP should try not to call release(true) in the engine's callbacks, call it this way in a separate thread instead. - * false: notify engine to release its resources and returns without waiting for resources are really destroyed - */ - virtual void release(bool sync=false) = 0; - - /** - * initialize the engine - * @param [in] context - * the RTC engine context - * @return return 0 if success or an error code - */ - virtual int initialize(const RtcEngineContext& context) = 0; - - /** - * get the pointer of the device manager object. - * @param [in] iid - * the iid of the interface you want to get - * @param [in, out] inter - * the pointer of the pointer you want to point to DeviceManager object - * @return return 0 if success or an error code - */ - virtual int queryInterface(INTERFACE_ID_TYPE iid, void** inter) = 0; - - /** - * get the version information of the SDK - * @param [in, out] build - * the build number - * @return return the version number string in char format - */ - virtual const char* getVersion(int* build) = 0; - - /** - * get the version information of the SDK - * @param [in, out] code - * the build number - * @return return the version number string in char format - */ - virtual const char* getErrorDescription(int code) = 0; - - /** - * join the channel, if the channel have not been created, it will been created automatically - * @param [in] channelKey - * the channel key, if you have initialized the engine with an available APP ID, it can be null here. If you enable channel key on the dashboard, specify channel key here - * @param [in] channelName - * the channel name - * @param [in] info - * the additional information, it can be null here - * @param [in] uid - * the uid of you, if 0 the system will automatically allocate one for you - * @return return 0 if success or an error code - */ - virtual int joinChannel(const char* channelKey, const char* channelName, const char* info, uid_t uid) = 0; - - /** - * leave the current channel - * @return return 0 if success or an error code - */ - virtual int leaveChannel() = 0; - - /** - * renew the channel key for the current channel - * @param [in] channelKey the renewed channel key, if old channel key expired. - * @return return 0 if success or an error code - */ - virtual int renewChannelKey(const char* channelKey) = 0; - - virtual int setChannelProfile(CHANNEL_PROFILE_TYPE profile) = 0; - virtual int setClientRole(CLIENT_ROLE_TYPE role, const char* permissionKey) = 0; - - /** - * start the echo testing, if every thing goes well you can hear your echo from the server - * @return return 0 if success or an error code - */ - virtual int startEchoTest() = 0; - - /** - * stop the echo testing - * @return return 0 if success or an error code - */ - virtual int stopEchoTest() = 0; - - /** - * start the network testing - * @return return 0 if success or an error code - */ - virtual int enableLastmileTest() = 0; - - /** - * stop the network testing - * @return return 0 if success or an error code - */ - virtual int disableLastmileTest() = 0; - - /** - * enable video function - * @return return 0 if success or an error code - */ - virtual int enableVideo() = 0; - - /** - * disable video function - * @return return 0 if success or an error code - */ - virtual int disableVideo() = 0; - - /** - * start the local video previewing - * @return return 0 if success or an error code - */ - virtual int startPreview() = 0; - - /** - * stop the local video previewing - * @return return 0 if success or an error code - */ - virtual int stopPreview() = 0; - - virtual int setVideoProfile(VIDEO_PROFILE_TYPE profile, bool swapWidthAndHeight) = 0; - /** - * set the remote video canvas - * @param [in] canvas - * the canvas information - * @return return 0 if success or an error code - */ - virtual int setupRemoteVideo(const VideoCanvas& canvas) = 0; - - /** - * set the local video canvas - * @param [in] canvas - * the canvas information - * @return return 0 if success or an error code - */ - virtual int setupLocalVideo(const VideoCanvas& canvas) = 0; - - /** - * enable audio function, which is enabled by deault. - * @return return 0 if success or an error code - */ - virtual int enableAudio() = 0; - - /** - * disable audio function - * @return return 0 if success or an error code - */ - virtual int disableAudio() = 0; - - virtual int setAudioProfile(AUDIO_PROFILE_TYPE profile, AUDIO_SCENARIO_TYPE scenario) = 0; - - /** - * get self call id in the current channel - * @param [in, out] callId - * the self call Id - * @return return 0 if success or an error code - */ - virtual int getCallId(agora::util::AString& callId) = 0; - - virtual int rate(const char* callId, int rating, const char* description) = 0; // 0~10 - virtual int complain(const char* callId, const char* description) = 0; - - /** - * register a packet observer while the packet arrived or ready to be sent, the observer can touch the packet data - * @param [in] observer - * the pointer of the observer object - * @return return 0 if success or an error code - */ - virtual int registerPacketObserver(IPacketObserver* observer) = 0; - - /** - * Specify encryption mode of AES encryption algorithm. - * @param [in] encryptionMode - * encryption mode of AES algorithm, could be one of the following: - * "aes-128-xts", "aes-256-xts". - * The default value is "aes-128-xts". specify NULL value will use default encryption mode. - * @return return 0 if success or an error code - */ - virtual int setEncryptionMode(const char* encryptionMode) = 0; - /** - * Specify encryption secret enables built-in encryption function. Leaving channel will clear the secret specified in last channel - * @param [in] secret - * secret to enable encryption - * @return return 0 if success or an error code - */ - virtual int setEncryptionSecret(const char* secret) = 0; - - virtual int createDataStream(int* streamId, bool reliable, bool ordered) = 0; - virtual int sendStreamMessage(int streamId, const char* data, size_t length) = 0; - - virtual int setVideoCompositingLayout(const VideoCompositingLayout& sei) = 0; - virtual int clearVideoCompositingLayout() = 0; - -#if defined(_WIN32) - virtual int configPublisher(const PublisherConfiguration& config) = 0; -#endif -}; - - -class IRtcEngineParameter -{ -public: - /** - * release the resource - */ - virtual void release() = 0; - - /** - * set bool value of the json - * @param [in] key - * the key name - * @param [in] value - * the value - * @return return 0 if success or an error code - */ - virtual int setBool(const char* key, bool value) = 0; - - /** - * set int value of the json - * @param [in] key - * the key name - * @param [in] value - * the value - * @return return 0 if success or an error code - */ - virtual int setInt(const char* key, int value) = 0; - - /** - * set unsigned int value of the json - * @param [in] key - * the key name - * @param [in] value - * the value - * @return return 0 if success or an error code - */ - virtual int setUInt(const char* key, unsigned int value) = 0; - - /** - * set double value of the json - * @param [in] key - * the key name - * @param [in] value - * the value - * @return return 0 if success or an error code - */ - virtual int setNumber(const char* key, double value) = 0; - - /** - * set string value of the json - * @param [in] key - * the key name - * @param [in] value - * the value - * @return return 0 if success or an error code - */ - virtual int setString(const char* key, const char* value) = 0; - - /** - * set object value of the json - * @param [in] key - * the key name - * @param [in] value - * the value - * @return return 0 if success or an error code - */ - virtual int setObject(const char* key, const char* value) = 0; - - /** - * get bool value of the json - * @param [in] key - * the key name - * @param [in, out] value - * the value - * @return return 0 if success or an error code - */ - virtual int getBool(const char* key, bool& value) = 0; - - /** - * get int value of the json - * @param [in] key - * the key name - * @param [in, out] value - * the value - * @return return 0 if success or an error code - */ - virtual int getInt(const char* key, int& value) = 0; - - /** - * get unsigned int value of the json - * @param [in] key - * the key name - * @param [in, out] value - * the value - * @return return 0 if success or an error code - */ - virtual int getUInt(const char* key, unsigned int& value) = 0; - - /** - * get double value of the json - * @param [in] key - * the key name - * @param [in, out] value - * the value - * @return return 0 if success or an error code - */ - virtual int getNumber(const char* key, double& value) = 0; - - /** - * get string value of the json - * @param [in] key - * the key name - * @param [in, out] value - * the value - * @return return 0 if success or an error code - */ - virtual int getString(const char* key, agora::util::AString& value) = 0; - - /** - * get a child object value of the json - * @param [in] key - * the key name - * @param [in, out] value - * the value - * @return return 0 if success or an error code - */ - virtual int getObject(const char* key, agora::util::AString& value) = 0; - - /** - * get array value of the json - * @param [in] key - * the key name - * @param [in, out] value - * the value - * @return return 0 if success or an error code - */ - virtual int getArray(const char* key, agora::util::AString& value) = 0; - - /** - * set parameters of the sdk or engine - * @param [in] parameters - * the parameters - * @return return 0 if success or an error code - */ - virtual int setParameters(const char* parameters) = 0; - - /** - * set profile to control the RTC engine - * @param [in] profile - * the profile - * @param [in] merge - * if merge with the original value - * @return return 0 if success or an error code - */ - virtual int setProfile(const char* profile, bool merge) = 0; - - virtual int convertPath(const char* filePath, agora::util::AString& value) = 0; -}; - -class AAudioDeviceManager : public agora::util::AutoPtr -{ -public: - AAudioDeviceManager(IRtcEngine* engine) - { - queryInterface(engine, AGORA_IID_AUDIO_DEVICE_MANAGER); - } -}; - -class AVideoDeviceManager : public agora::util::AutoPtr -{ -public: - AVideoDeviceManager(IRtcEngine* engine) - { - queryInterface(engine, AGORA_IID_VIDEO_DEVICE_MANAGER); - } -}; - -class AParameter : public agora::util::AutoPtr -{ -public: - AParameter(IRtcEngine& engine) { initialize(&engine); } - AParameter(IRtcEngine* engine) { initialize(engine); } - AParameter(IRtcEngineParameter* p) :agora::util::AutoPtr(p) {} -private: - bool initialize(IRtcEngine* engine) - { - IRtcEngineParameter* p = NULL; - if (engine && !engine->queryInterface(AGORA_IID_RTC_ENGINE_PARAMETER, (void**)&p)) - reset(p); - return p != NULL; - } -}; - -class RtcEngineParameters -{ -public: - RtcEngineParameters(IRtcEngine& engine) - :m_parameter(&engine){} - RtcEngineParameters(IRtcEngine* engine) - :m_parameter(engine){} - - /** - * mute/unmute the local stream capturing - * @param [in] mute - * true: mute - * false: unmute - * @return return 0 if success or an error code - */ - int muteLocalAudioStream(bool mute) { - return setParameters("{\"rtc.audio.mute_me\":%s,\"che.audio.mute_me\":%s}", mute ? "true" : "false", mute ? "true" : "false"); - } - // mute/unmute all peers. unmute will clear all muted peers specified mutePeer() interface - /** - * mute/unmute all the remote audio stream receiving - * @param [in] mute - * true: mute - * false: unmute - * @return return 0 if success or an error code - */ - int muteAllRemoteAudioStreams(bool mute) { - return m_parameter ? m_parameter->setBool("rtc.audio.mute_peers", mute) : -ERR_NOT_INITIALIZED; - } - - /** - * mute/unmute one remote audio stream receiving - * @param [in] uid - * the uid of the remote user you want to mute/unmute - * @param [in] mute - * true: mute - * false: unmute - * @return return 0 if success or an error code - */ - int muteRemoteAudioStream(uid_t uid, bool mute) { - return setObject("rtc.audio.mute_peer", "{\"uid\":%u,\"mute\":%s}", uid, mute?"true":"false"); - } - - /** - * mute/unmute local video stream sending - * @param [in] mute - * true: mute - * false: unmute - * @return return 0 if success or an error code - */ - int muteLocalVideoStream(bool mute) { - return setParameters("{\"rtc.video.mute_me\":%s,\"che.video.local.send\":%s}", mute ? "true" : "false", mute ? "false" : "true"); - } - - int enableLocalVideo(bool enabled) { - return setParameters("{\"rtc.video.capture\":%s,\"che.video.local.capture\":%s,\"che.video.local.render\":%s,\"che.video.local.send\":%s}", enabled ? "true" : "false", enabled ? "true" : "false", enabled ? "true" : "false", enabled ? "true" : "false"); - } - /** - * mute/unmute all the remote video stream receiving - * @param [in] mute - * true: mute - * false: unmute - * @return return 0 if success or an error code - */ - int muteAllRemoteVideoStreams(bool mute) { - return m_parameter ? m_parameter->setBool("rtc.video.mute_peers", mute) : -ERR_NOT_INITIALIZED; - } - - /** - * mute/unmute one remote video stream receiving - * @param [in] uid - * the uid of the remote user you want to mute/unmute - * @param [in] mute - * true: mute - * false: unmute - * @return return 0 if success or an error code - */ - int muteRemoteVideoStream(uid_t uid, bool mute) { - return setObject("rtc.video.mute_peer", "{\"uid\":%u,\"mute\":%s}", uid, mute ? "true" : "false"); - } - - int setRemoteVideoStreamType(uid_t uid, REMOTE_VIDEO_STREAM_TYPE streamType) { - return setParameters("{\"rtc.video.set_remote_video_stream\":{\"uid\":%u,\"stream\":%d}, \"che.video.setstream\":{\"uid\":%u,\"stream\":%d}}", uid, streamType, uid, streamType); -// return setObject("rtc.video.set_remote_video_stream", "{\"uid\":%u,\"stream\":%d}", uid, streamType); - } - - int setRemoteDefaultVideoStreamType(REMOTE_VIDEO_STREAM_TYPE streamType) { - return m_parameter ? m_parameter->setInt("rtc.video.set_remote_default_video_stream_type", streamType) : -ERR_NOT_INITIALIZED; - } - - /** - * set play sound volume - * @param [in] volume - * the volume 0~255 - * @return return 0 if success or an error code - */ - int setPlaybackDeviceVolume(int volume) {// [0,255] - return m_parameter ? m_parameter->setInt("che.audio.output.volume", volume) : -ERR_NOT_INITIALIZED; - } - - /** - * enable or disable the audio volume indication - * @param [in] interval - * the period of the call back cycle, in ms - * interval <= 0: disable - * interval > 0: enable - * @param [in] smooth - * the smooth parameter - * @return return 0 if success or an error code - */ - int enableAudioVolumeIndication(int interval, int smooth) { // in ms: <= 0: disable, > 0: enable, interval in ms - if (interval < 0) - interval = 0; - return setObject("che.audio.volume_indication", "{\"interval\":%d,\"smooth\":%d}", interval, smooth); - } - - /** - * start recording the audio stream - * @param [in] filePath - * the .wav file path you want to saved - * @return return 0 if success or an error code - */ - int startAudioRecording(const char* filePath, AUDIO_RECORDING_QUALITY_TYPE quality) { - if (!m_parameter) return -ERR_NOT_INITIALIZED; -#if defined(_WIN32) - util::AString path; - if (!m_parameter->convertPath(filePath, path)) - filePath = path->c_str(); - else - return -ERR_INVALID_ARGUMENT; -#endif - return setObject("che.audio.start_recording", "{\"filePath\":\"%s\",\"quality\":%d}", filePath, quality); - } - - /** - * stop recording the audio stream - * @return return 0 if success or an error code - */ - int stopAudioRecording() { - return m_parameter ? m_parameter->setBool("che.audio.stop_recording", true) : -ERR_NOT_INITIALIZED; - } - - /** - * mix microphone and local audio file into the audio stream - * @param [in] filePath - * specify the path and file name of the audio file to be played - * @param [in] loopback - * specify if local and remote participant can hear the audio file. - * false (default): both local and remote party can hear the the audio file - * true: only the local party can hear the audio file - * @param [in] replace - * false (default): mix the local microphone captured voice with the audio file - * true: replace the microphone captured voice with the audio file - * @param [in] cycle - * specify the number of cycles to play - * -1, infinite loop playback - * @return return 0 if success or an error code - */ - int startAudioMixing(const char* filePath, bool loopback, bool replace, int cycle) { - if (!m_parameter) return -ERR_NOT_INITIALIZED; -#if defined(_WIN32) - util::AString path; - if (!m_parameter->convertPath(filePath, path)) - filePath = path->c_str(); - else - return -ERR_INVALID_ARGUMENT; -#endif - return setObject("che.audio.start_file_as_playout", "{\"filePath\":\"%s\",\"loopback\":%s,\"replace\":%s,\"cycle\":%d}", - filePath, - loopback?"true":"false", - replace?"true":"false", - cycle); - } - /** - * stop mixing the local audio stream - * @return return 0 if success or an error code - */ - int stopAudioMixing() { - return m_parameter ? m_parameter->setBool("che.audio.stop_file_as_playout", true) : -ERR_NOT_INITIALIZED; - } - - int pauseAudioMixing() { - return m_parameter ? m_parameter->setBool("che.audio.pause_file_as_playout", true) : -ERR_NOT_INITIALIZED; - } - - int resumeAudioMixing() { - return m_parameter ? m_parameter->setBool("che.audio.pause_file_as_playout", false) : -ERR_NOT_INITIALIZED; - } - - int adjustAudioMixingVolume(int volume) { - return m_parameter ? m_parameter->setInt("che.audio.set_file_as_playout_volume", volume) : -ERR_NOT_INITIALIZED; - } - int getAudioMixingDuration() { - int duration = 0; - int r = m_parameter ? m_parameter->getInt("che.audio.get_mixing_file_length_ms", duration) : -ERR_NOT_INITIALIZED; - if (r == 0) - r = duration; - return r; - } - int getAudioMixingCurrentPosition() { - if (!m_parameter) return -ERR_NOT_INITIALIZED; - int pos = 0; - int r = m_parameter->getInt("che.audio.get_mixing_file_played_ms", pos); - if (r == 0) - r = pos; - return r; - } - int setAudioMixingPosition(int pos /*in ms*/) { - return m_parameter ? m_parameter->setInt("che.audio.mixing.file.position", pos) : -ERR_NOT_INITIALIZED; - } - /** - * Change the pitch of local speaker's voice - * @param [in] pitch - * frequency, in the range of [0.5..2.0], default value is 1.0 - * - * @return return 0 if success or an error code - */ - int setLocalVoicePitch(double pitch) { - return m_parameter ? m_parameter->setInt( - "che.audio.game_local_pitch_shift", - static_cast(pitch * 100)) : -ERR_NOT_INITIALIZED; - } - /** - * Set the audio ears back's volume and effect - * @param [in] volume - * set volume of audio ears back, in the range of [0..100], default value is 100 - * - * @return return 0 if success or an error code - */ - int setInEarMonitoringVolume(int volume) { - return m_parameter ? m_parameter->setInt("che.audio.headset.monitoring.parameter", volume) : -ERR_NOT_INITIALIZED; - } - /** - * set audio profile and scenario - * including sample rate, bit rate, mono/stereo, speech/music codec - * - * @param [in] profile - * enumeration definition about the audio's samplerate, bitrate, mono/stereo, speech/music codec - * @param [in] scenario - * enumeration definition about the audio scenario - * - * @return 0 when executed successfully. return negative value if failed. - */ - int setAudioProfile(AUDIO_PROFILE_TYPE profile, AUDIO_SCENARIO_TYPE scenario) { - return setObject( - "che.audio.profile", - "{\"config\":%d,\"scenario\":%d}", - static_cast(profile), static_cast(scenario)); - } - - /** - * disable audio function in channel, which will be recovered when leave channel. - * @return return 0 if success or an error code - */ - int pauseAudio() { - return m_parameter ? m_parameter->setBool("che.pause.audio", true) : -ERR_NOT_INITIALIZED; - } - - /** - * resume audio function in channel. - * @return return 0 if success or an error code - */ - int resumeAudio() { - return m_parameter ? m_parameter->setBool("che.pause.audio", false) : -ERR_NOT_INITIALIZED; - } - - int setExternalAudioSource(bool enabled, int sampleRate, int channels) { - if (enabled) - return setParameters("{\"che.audio.external_capture\":true,\"che.audio.external_capture.push\":true,\"che.audio.set_capture_raw_audio_format\":{\"sampleRate\":%d,\"channelCnt\":%d,\"mode\":%d}}", sampleRate, channels, RAW_AUDIO_FRAME_OP_MODE_TYPE::RAW_AUDIO_FRAME_OP_MODE_READ_WRITE); - else - return setParameters("{\"che.audio.external_capture\":false,\"che.audio.external_capture.push\":false}"); - } -#if defined(__APPLE__) - /** - * start screen/windows capture - * - * @param windowId screen capture, if windowId is 0; windows capture if windowsId isn't 0; - * @param rect valid when windowId is 0; whole screen if rect is NULL. - * - * @return return 0 if success or an error code - */ - int startScreenCapture(unsigned int windowId, int captureFreq, const Rect *rect) { - if (!rect) - return setObject("che.video.start_screen_capture", "{\"id\":%u,\"captureFreq\":%d}", windowId, captureFreq); - else - return setObject("che.video.start_screen_capture", "{\"id\":%u,\"captureFreq\":%d,\"top\":%d,\"left\":%d,\"bottom\":%d,\"right\":%d}", windowId, captureFreq, rect->top, rect->left, rect->bottom, rect->right); - } - - /** - * stop screen capture - * @return return 0 if success or an error code - */ - int stopScreenCapture() { - return m_parameter ? m_parameter->setBool("che.video.stop_screen_capture", true) : -ERR_NOT_INITIALIZED; - } - - /** - * update screen capture region - * - * @param rect valid when windowId is 0; whole screen if rect is NULL. - * - * @return return 0 if success or an error code - */ - int updateScreenCaptureRegion(const Rect *rect) { - if (!rect) - return setObject("che.video.update_screen_capture_region", "{}"); - else - return setObject("che.video.update_screen_capture_region", "{\"top\":%d,\"left\":%d,\"bottom\":%d,\"right\":%d}", rect->top, rect->left, rect->bottom, rect->right); - } -#elif defined(_WIN32) - /** - * start screen/windows capture - * - * @param windowId screen capture, if windowId is 0; windows capture if windowsId isn't 0; - * @param rect valid when windowId is 0; whole screen if rect is NULL. - * - * @return return 0 if success or an error code - */ - int startScreenCapture(HWND windowId, int captureFreq, const Rect *rect) { - if (!rect) - return setObject("che.video.start_screen_capture", "{\"id\":%u,\"captureFreq\":%d}", (unsigned int)windowId, captureFreq); - else - return setObject("che.video.start_screen_capture", "{\"id\":%u,\"captureFreq\":%d,\"top\":%d,\"left\":%d,\"bottom\":%d,\"right\":%d}", (unsigned int)windowId, captureFreq, rect->top, rect->left, rect->bottom, rect->right); - } - - /** - * stop screen capture - * @return return 0 if success or an error code - */ - int stopScreenCapture() { - return m_parameter ? m_parameter->setBool("che.video.stop_screen_capture", true) : -ERR_NOT_INITIALIZED; - } - - /** - * update screen capture region - * - * @param rect valid when windowId is 0; whole screen if rect is NULL. - * - * @return return 0 if success or an error code - */ - int updateScreenCaptureRegion(const Rect *rect) { - if (!rect) - return setObject("che.video.update_screen_capture_region", "{}"); - else - return setObject("che.video.update_screen_capture_region", "{\"top\":%d,\"left\":%d,\"bottom\":%d,\"right\":%d}", rect->top, rect->left, rect->bottom, rect->right); - } -#endif - - /** - * set path to save the log file - * @param [in] filePath - * the .log file path you want to saved - * @return return 0 if success or an error code - */ - int setLogFile(const char* filePath) { - if (!m_parameter) return -ERR_NOT_INITIALIZED; -#if defined(_WIN32) - util::AString path; - if (!m_parameter->convertPath(filePath, path)) - filePath = path->c_str(); - else if (!filePath) - filePath = ""; -#endif - return m_parameter->setString("rtc.log_file", filePath); - } - - /** - * set the log information filter level - * @param [in] filter - * the filter level - * @return return 0 if success or an error code - */ - int setLogFilter(unsigned int filter) { - return m_parameter ? m_parameter->setUInt("rtc.log_filter", filter&LOG_FILTER_MASK) : -ERR_NOT_INITIALIZED; - } - - /** - * set local video render mode - * @param [in] renderMode - * the render mode - * @return return 0 if success or an error code - */ - int setLocalRenderMode(RENDER_MODE_TYPE renderMode) { - return setRemoteRenderMode(0, renderMode); - } - - /** - * set remote video render mode - * @param [in] renderMode - * the render mode - * @return return 0 if success or an error code - */ - int setRemoteRenderMode(uid_t uid, RENDER_MODE_TYPE renderMode) { - return setObject("che.video.render_mode", "{\"uid\":%u,\"mode\":%d}", uid, renderMode); - } - - int setLocalVideoMirrorMode(VIDEO_MIRROR_MODE_TYPE mirrorMode) { - if (!m_parameter) return -ERR_NOT_INITIALIZED; - const char *value; - switch (mirrorMode) { - case VIDEO_MIRROR_MODE_AUTO: - value = "default"; - break; - case VIDEO_MIRROR_MODE_ENABLED: - value = "forceMirror"; - break; - case VIDEO_MIRROR_MODE_DISABLED: - value = "disableMirror"; - break; - default: - return -ERR_INVALID_ARGUMENT; - } - return m_parameter->setString("che.video.localViewMirrorSetting", value); - } - int startRecordingService(const char* recordingKey) { - return m_parameter ? m_parameter->setString("rtc.api.start_recording_service", recordingKey) : -ERR_NOT_INITIALIZED; - } - - int stopRecordingService(const char* recordingKey) { - return m_parameter ? m_parameter->setString("rtc.api.stop_recording_service", recordingKey) : -ERR_NOT_INITIALIZED; - } - - int refreshRecordingServiceStatus() { - return m_parameter ? m_parameter->setBool("rtc.api.query_recording_service_status", true) : -ERR_NOT_INITIALIZED; - } - - int enableDualStreamMode(bool enabled) { - return setParameters("{\"rtc.dual_stream_mode\":%s,\"che.video.enableLowBitRateStream\":%d}", enabled ? "true" : "false", enabled ? 1 : 0); - } - - int setRecordingAudioFrameParameters(int sampleRate, int channel, RAW_AUDIO_FRAME_OP_MODE_TYPE mode, int samplesPerCall) { - return setObject("che.audio.set_capture_raw_audio_format", "{\"sampleRate\":%d,\"channelCnt\":%d,\"mode\":%d,\"samplesPerCall\":%d}", sampleRate, channel, mode, samplesPerCall); - } - int setPlaybackAudioFrameParameters(int sampleRate, int channel, RAW_AUDIO_FRAME_OP_MODE_TYPE mode, int samplesPerCall) { - return setObject("che.audio.set_render_raw_audio_format", "{\"sampleRate\":%d,\"channelCnt\":%d,\"mode\":%d,\"samplesPerCall\":%d}", sampleRate, channel, mode, samplesPerCall); - } - int setMixedAudioFrameParameters(int sampleRate, int samplesPerCall) { - return setObject("che.audio.set_mixed_raw_audio_format", "{\"sampleRate\":%d,\"samplesPerCall\":%d}", sampleRate, samplesPerCall); - } - - int adjustRecordingSignalVolume(int volume) {//[0, 400]: e.g. 50~0.5x 100~1x 400~4x - if (volume < 0) - volume = 0; - else if (volume > 400) - volume = 400; - return m_parameter ? m_parameter->setInt("che.audio.record.signal.volume", volume) : -ERR_NOT_INITIALIZED; - } - int adjustPlaybackSignalVolume(int volume) {//[0, 400] - if (volume < 0) - volume = 0; - else if (volume > 400) - volume = 400; - return m_parameter ? m_parameter->setInt("che.audio.playout.signal.volume", volume) : -ERR_NOT_INITIALIZED; - } - int setHighQualityAudioParameters(bool fullband, bool stereo, bool fullBitrate) { - return setObject("che.audio.codec.hq", "{\"fullband\":%s,\"stereo\":%s,\"fullBitrate\":%s}", fullband ? "true" : "false", stereo ? "true" : "false", fullBitrate ? "true" : "false"); - } - int enableWebSdkInteroperability(bool enabled) {//enable interoperability with zero-plugin web sdk - return setParameters("{\"rtc.video.web_h264_interop_enable\":%s,\"che.video.web_h264_interop_enable\":%s}", enabled ? "true" : "false", enabled ? "true" : "false"); - } - //only for live broadcasting - int setVideoQualityParameters(bool preferFrameRateOverImageQuality) { - return setParameters("{\"rtc.video.prefer_frame_rate\":%s,\"che.video.prefer_frame_rate\":%s}", preferFrameRateOverImageQuality ? "true" : "false", preferFrameRateOverImageQuality ? "true" : "false"); - } -protected: - AParameter& parameter() { - return m_parameter; - } - int setParameters(const char* format, ...) { - char buf[512]; - va_list args; - va_start(args, format); - vsnprintf(buf, sizeof(buf)-1, format, args); - va_end(args); - return m_parameter ? m_parameter->setParameters(buf) : -ERR_NOT_INITIALIZED; - } - int setObject(const char* key, const char* format, ...) { - char buf[512]; - va_list args; - va_start(args, format); - vsnprintf(buf, sizeof(buf)-1, format, args); - va_end(args); - return m_parameter ? m_parameter->setObject(key, buf) : -ERR_NOT_INITIALIZED; - } - int enableLocalVideoCapture(bool enabled) { - return m_parameter ? m_parameter->setBool("che.video.local.capture", enabled) : -ERR_NOT_INITIALIZED; - } - int enableLocalVideoRender(bool enabled) { - return m_parameter ? m_parameter->setBool("che.video.local.render", enabled) : -ERR_NOT_INITIALIZED; - } - int enableLocalVideoSend(bool enabled) { - return muteLocalVideoStream(!enabled); - } - int stopAllRemoteVideo() { - return m_parameter ? m_parameter->setBool("che.video.peer.stop_render", true) : -ERR_NOT_INITIALIZED; - } -private: - AParameter m_parameter; -}; - -} //namespace rtc -} // namespace agora - -/** -* to get the version number of the SDK -* @param [in, out] build -* the build number of Agora SDK -* @return returns the string of the version of the SDK -*/ -AGORA_API const char* AGORA_CALL getAgoraRtcEngineVersion(int* build); - -/** -* create the RTC engine object and return the pointer -* @return returns the pointer of the RTC engine object -*/ -AGORA_API agora::rtc::IRtcEngine* AGORA_CALL createAgoraRtcEngine(); - -/** -* create the RTC engine object and return the pointer -* @param [in] err -* the error code -* @return returns the description of the error code -*/ -AGORA_API const char* AGORA_CALL getAgoraRtcEngineErrorDescription(int err); - -AGORA_API int AGORA_CALL setAgoraRtcEngineExternalSymbolLoader(void* (*func)(const char* symname)); - -#endif diff --git a/android/src/main/jniLibs/x86/libagora-crypto.so b/android/src/main/jniLibs/x86/libagora-crypto.so deleted file mode 100755 index 1b5919e39..000000000 --- a/android/src/main/jniLibs/x86/libagora-crypto.so +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:4bcff7feb240245929181925615a8d0c6dae29421d7addcc63944e8f0d38f24c -size 2252020 diff --git a/android/src/main/jniLibs/x86/libagora-rtc-sdk-jni.so b/android/src/main/jniLibs/x86/libagora-rtc-sdk-jni.so deleted file mode 100755 index b0a1a3741..000000000 --- a/android/src/main/jniLibs/x86/libagora-rtc-sdk-jni.so +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b26bd88d0fa14fc86740dc202aa52f45e4e83f3b7e56f7706629298bade49eeb -size 12276564 diff --git a/package-lock.json b/package-lock.json index bd08bb9cd..3bb993823 100644 --- a/package-lock.json +++ b/package-lock.json @@ -53,12 +53,12 @@ } }, "@babel/generator": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.3.0.tgz", - "integrity": "sha512-dZTwMvTgWfhmibq4V9X+LMf6Bgl7zAodRn9PvcPdhlzFMbvUutx74dbEv7Atz3ToeEpevYEJtAwfxq/bDCzHWg==", + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.3.2.tgz", + "integrity": "sha512-f3QCuPppXxtZOEm5GWPra/uYUjmNQlu9pbAD8D/9jze4pTY83rTtB1igTBSwvkeNlC5gR24zFFkz+2WHLFQhqQ==", "dev": true, "requires": { - "@babel/types": "^7.3.0", + "@babel/types": "^7.3.2", "jsesc": "^2.5.1", "lodash": "^4.17.10", "source-map": "^0.5.0", @@ -106,9 +106,9 @@ } }, "@babel/helper-create-class-features-plugin": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.3.0.tgz", - "integrity": "sha512-DUsQNS2CGLZZ7I3W3fvh0YpPDd6BuWJlDl+qmZZpABZHza2ErE3LxtEzLJFHFC1ZwtlAXvHhbFYbtM5o5B0WBw==", + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.3.2.tgz", + "integrity": "sha512-tdW8+V8ceh2US4GsYdNVNoohq5uVwOf9k6krjwW4E1lINcHgttnWcNqgdoessn12dAy8QkbezlbQh2nXISNY+A==", "dev": true, "requires": { "@babel/helper-function-name": "^7.1.0", @@ -302,18 +302,41 @@ "js-tokens": "^4.0.0" }, "dependencies": { - "js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } } } }, "@babel/parser": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.3.1.tgz", - "integrity": "sha512-ATz6yX/L8LEnC3dtLQnIx4ydcPxhLcoy9Vl6re00zb2w5lG6itY6Vhnr1KFRPq/FHNsgl/gh2mjNN20f9iJTTA==", + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.3.2.tgz", + "integrity": "sha512-QzNUC2RO1gadg+fs21fi0Uu0OuGNzRKEmgCxoLNzbCdoprLwjfmZwzUrpUNfJPaVRwBpDY47A17yYEGWyRelnQ==", "dev": true }, "@babel/plugin-external-helpers": { @@ -356,9 +379,9 @@ } }, "@babel/plugin-proposal-object-rest-spread": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.3.1.tgz", - "integrity": "sha512-Nmmv1+3LqxJu/V5jU9vJmxR/KIRWFk2qLHmbB56yRRRFhlaSuOVXscX3gUmhaKgUhzA3otOHVubbIEVYsZ0eZg==", + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.3.2.tgz", + "integrity": "sha512-DjeMS+J2+lpANkYLLO+m6GjoTMygYglKmRe6cDTbFv3L9i6mmiE8fe6B8MtCSLZpVXscD5kn7s6SgtHrDoBWoA==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0", @@ -528,14 +551,6 @@ "@babel/helper-replace-supers": "^7.1.0", "@babel/helper-split-export-declaration": "^7.0.0", "globals": "^11.1.0" - }, - "dependencies": { - "globals": { - "version": "11.10.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.10.0.tgz", - "integrity": "sha512-0GZF1RiPKU97IHUO5TORo9w1PwrH/NBPl+fS7oMLdaTRiYmYbwK4NWoZWrAdd0/abG9R2BU+OiwyQpTpE6pdfQ==", - "dev": true - } } }, "@babel/plugin-transform-computed-properties": { @@ -548,9 +563,9 @@ } }, "@babel/plugin-transform-destructuring": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.2.0.tgz", - "integrity": "sha512-coVO2Ayv7g0qdDbrNiadE4bU7lvCd9H539m2gMknyVjjMdwF/iCOM7R+E8PkntoqLkltO0rk+3axhpp/0v68VQ==", + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.3.2.tgz", + "integrity": "sha512-Lrj/u53Ufqxl/sGxyjsJ2XNtNuEjDyjpqdhMNh5aZ+XFOdThL46KBj27Uem4ggoezSYBxKWAil6Hu8HtwqesYw==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0" @@ -753,9 +768,9 @@ } }, "@babel/plugin-transform-typescript": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.2.0.tgz", - "integrity": "sha512-EnI7i2/gJ7ZNr2MuyvN2Hu+BHJENlxWte5XygPvfj/MbvtOkWor9zcnHpMMQL2YYaaCcqtIvJUyJ7QVfoGs7ew==", + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.3.2.tgz", + "integrity": "sha512-Pvco0x0ZSCnexJnshMfaibQ5hnK8aUHSvjCQhC1JR8eeg+iBwt0AtCO7gWxJ358zZevuf9wPSO5rv+WJcbHPXQ==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0", @@ -788,6 +803,12 @@ "source-map-support": "^0.5.9" }, "dependencies": { + "core-js": { + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.4.tgz", + "integrity": "sha512-05qQ5hXShcqGkPZpXEFLIpxayZscVD2kuMBZewxiIPPEagukO4mqgPA9CWhUvFBJfy3ODdK2p9xyHh7FTU9/7A==", + "dev": true + }, "home-or-tmp": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-3.0.0.tgz", @@ -850,12 +871,6 @@ "ms": "^2.1.1" } }, - "globals": { - "version": "11.10.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.10.0.tgz", - "integrity": "sha512-0GZF1RiPKU97IHUO5TORo9w1PwrH/NBPl+fS7oMLdaTRiYmYbwK4NWoZWrAdd0/abG9R2BU+OiwyQpTpE6pdfQ==", - "dev": true - }, "ms": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", @@ -865,28 +880,20 @@ } }, "@babel/types": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.3.0.tgz", - "integrity": "sha512-QkFPw68QqWU1/RVPyBe8SO7lXbPfjtqAxRYQKpFpaB8yMq7X2qAqfwK5LKoQufEkSmO5NQ70O6Kc3Afk03RwXw==", + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.3.2.tgz", + "integrity": "sha512-3Y6H8xlUlpbGR+XvawiH0UXehqydTmNmEpozWcXymqwcrwYAl5KMvKtQ+TF6f6E08V6Jur7v/ykdDSF+WDEIXQ==", "dev": true, "requires": { "esutils": "^2.0.2", "lodash": "^4.17.10", "to-fast-properties": "^2.0.0" - }, - "dependencies": { - "to-fast-properties": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", - "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", - "dev": true - } } }, "@types/jest": { - "version": "23.3.13", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-23.3.13.tgz", - "integrity": "sha512-ePl4l+7dLLmCucIwgQHAgjiepY++qcI6nb8eAwGNkB6OxmTe3Z9rQU3rSpomqu42PCCnlThZbOoxsf+qylJsLA==", + "version": "23.3.14", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-23.3.14.tgz", + "integrity": "sha512-Q5hTcfdudEL2yOmluA1zaSyPbzWPmJ3XfSWeP3RyoYvS9hnje1ZyagrZOuQ6+1nQC1Gw+7gap3pLNL3xL6UBug==", "dev": true }, "@types/prop-types": { @@ -896,9 +903,9 @@ "dev": true }, "@types/react": { - "version": "16.7.22", - "resolved": "https://registry.npmjs.org/@types/react/-/react-16.7.22.tgz", - "integrity": "sha512-j/3tVoY09kHcTfbia4l67ofQn9xvktUvlC/4QN0KuBHAXlbU/wuGKMb8WfEb/vIcWxsOxHv559uYprkFDFfP8Q==", + "version": "16.8.2", + "resolved": "https://registry.npmjs.org/@types/react/-/react-16.8.2.tgz", + "integrity": "sha512-6mcKsqlqkN9xADrwiUz2gm9Wg4iGnlVGciwBRYFQSMWG6MQjhOZ/AVnxn+6v8nslFgfYTV8fNdE6XwKu6va5PA==", "dev": true, "requires": { "@types/prop-types": "*", @@ -906,9 +913,9 @@ } }, "@types/react-native": { - "version": "0.57.33", - "resolved": "https://registry.npmjs.org/@types/react-native/-/react-native-0.57.33.tgz", - "integrity": "sha512-mn6u8aeh7nxBGO82z/vQeFrlfkBIAAk69MIxSK0aIn8cQnaFqmsoaeSBPhc1K+oIbMXytfehl0w5U1H20OIk+A==", + "version": "0.57.35", + "resolved": "https://registry.npmjs.org/@types/react-native/-/react-native-0.57.35.tgz", + "integrity": "sha512-RQnpq9qi1JiAF9331r+WcBSsTYhpl3wcMZPI+UvZWwNG1X7HxZCgaU3+7/zb8VT8GAuKmmp0SUYXhxXba3C53A==", "dev": true, "requires": { "@types/prop-types": "*", @@ -916,9 +923,9 @@ } }, "@types/react-test-renderer": { - "version": "16.0.3", - "resolved": "https://registry.npmjs.org/@types/react-test-renderer/-/react-test-renderer-16.0.3.tgz", - "integrity": "sha512-NWOAxVQeJxpXuNKgw83Hah0nquiw1nUexM9qY/Hk3a+XhZwgMtaa6GLA9E1TKMT75Odb3/KE/jiBO4enTuEJjQ==", + "version": "16.8.0", + "resolved": "https://registry.npmjs.org/@types/react-test-renderer/-/react-test-renderer-16.8.0.tgz", + "integrity": "sha512-m563EQSTVB2g6h+FDUH2cgfiRdjL1KHVyi643EQQSFIblMPrWwJh/adqTcMS/FhJHvhEboR4pmhrhEXyHDDsmQ==", "dev": true, "requires": { "@types/react": "*" @@ -963,9 +970,9 @@ }, "dependencies": { "acorn": { - "version": "6.0.6", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.0.6.tgz", - "integrity": "sha512-5M3G/A4uBSMIlfJ+h9W125vJvPFH/zirISsW5qfxF5YzEvXJCtolLoQvM5yZft0DvMcUrPGKPOlgEu55I6iUtA==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.1.0.tgz", + "integrity": "sha512-MW/FjM+IvU9CgBzjO3UIPCE2pyEwUsoFl+VGdczOPEdxfGFjuKny/gN54mOuX7Qxmb9Rg9MCn2oKiSUeW+pjrw==", "dev": true } } @@ -977,9 +984,9 @@ "dev": true }, "ajv": { - "version": "6.7.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.7.0.tgz", - "integrity": "sha512-RZXPviBTtfmtka9n9sy1N5M5b82CbxWIR6HIis4s3WQTXDJamc/0gpCWNGz6EWdWp4DOfjzJfhz/AS9zVPjjWg==", + "version": "6.9.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.9.1.tgz", + "integrity": "sha512-XDN92U311aINL77ieWHmqCcNlwjoP5cHXDxIxbf2MaPYuCXOHS7gHH8jktxeK5omgd52XbSTX6a4Piwd1pQmzA==", "dev": true, "requires": { "fast-deep-equal": "^2.0.1", @@ -1043,13 +1050,10 @@ "dev": true }, "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true }, "ansi-wrap": { "version": "0.1.0", @@ -1248,29 +1252,10 @@ "js-tokens": "^3.0.2" }, "dependencies": { - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true - }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dev": true, - "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - } - }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "js-tokens": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", "dev": true } } @@ -1351,13 +1336,46 @@ } }, "babel-jest": { - "version": "24.0.0", - "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-24.0.0.tgz", - "integrity": "sha512-YGKRbZUjoRmNIAyG7x4wYxUyHvHPFpYXj6Mx1A5cslhaQOUgP/+LF3wtFgMuOQkIpjbVNBufmOnVY0QVwB5v9Q==", + "version": "24.1.0", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-24.1.0.tgz", + "integrity": "sha512-MLcagnVrO9ybQGLEfZUqnOzv36iQzU7Bj4elm39vCukumLVSfoX+tRy3/jW7lUKc7XdpRmB/jech6L/UCsSZjw==", "dev": true, "requires": { "babel-plugin-istanbul": "^5.1.0", - "babel-preset-jest": "^24.0.0" + "babel-preset-jest": "^24.1.0", + "chalk": "^2.4.2", + "slash": "^2.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } } }, "babel-messages": { @@ -1381,9 +1399,9 @@ } }, "babel-plugin-jest-hoist": { - "version": "24.0.0", - "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-24.0.0.tgz", - "integrity": "sha512-ipefE7YWNyRNVaV/MonUb/I5nef53ZRFR74P9meMGmJxqt8s1BJmfhw11YeIMbcjXN4fxtWUaskZZe8yreXE1Q==", + "version": "24.1.0", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-24.1.0.tgz", + "integrity": "sha512-gljYrZz8w1b6fJzKcsfKsipSru2DU2DmQ39aB6nV3xQ0DDv3zpIzKGortA5gknrhNnPN8DweaEgrnZdmbGmhnw==", "dev": true }, "babel-plugin-syntax-object-rest-spread": { @@ -1434,13 +1452,13 @@ } }, "babel-preset-jest": { - "version": "24.0.0", - "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-24.0.0.tgz", - "integrity": "sha512-ECMMOLvNDCmsn3geBa3JkwzylcfpThMpAdfreONQm8EmXcs4tXUpXZDQPxiIMg7nMobTuAC2zDGIKrbrBXW2Vg==", + "version": "24.1.0", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-24.1.0.tgz", + "integrity": "sha512-FfNLDxFWsNX9lUmtwY7NheGlANnagvxq8LZdl5PKnVG3umP+S/g0XbVBfwtA4Ai3Ri/IMkWabBz3Tyk9wdspcw==", "dev": true, "requires": { "@babel/plugin-syntax-object-rest-spread": "^7.0.0", - "babel-plugin-jest-hoist": "^24.0.0" + "babel-plugin-jest-hoist": "^24.1.0" } }, "babel-register": { @@ -1458,6 +1476,12 @@ "source-map-support": "^0.4.15" }, "dependencies": { + "core-js": { + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.4.tgz", + "integrity": "sha512-05qQ5hXShcqGkPZpXEFLIpxayZscVD2kuMBZewxiIPPEagukO4mqgPA9CWhUvFBJfy3ODdK2p9xyHh7FTU9/7A==", + "dev": true + }, "source-map-support": { "version": "0.4.18", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz", @@ -1477,6 +1501,14 @@ "requires": { "core-js": "^2.4.0", "regenerator-runtime": "^0.11.0" + }, + "dependencies": { + "core-js": { + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.4.tgz", + "integrity": "sha512-05qQ5hXShcqGkPZpXEFLIpxayZscVD2kuMBZewxiIPPEagukO4mqgPA9CWhUvFBJfy3ODdK2p9xyHh7FTU9/7A==", + "dev": true + } } }, "babel-template": { @@ -1507,6 +1539,14 @@ "globals": "^9.18.0", "invariant": "^2.2.2", "lodash": "^4.17.4" + }, + "dependencies": { + "globals": { + "version": "9.18.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", + "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", + "dev": true + } } }, "babel-types": { @@ -1519,6 +1559,14 @@ "esutils": "^2.0.2", "lodash": "^4.17.4", "to-fast-properties": "^1.0.3" + }, + "dependencies": { + "to-fast-properties": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz", + "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=", + "dev": true + } } }, "babylon": { @@ -1796,9 +1844,9 @@ "dev": true }, "camelcase": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", - "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.0.0.tgz", + "integrity": "sha512-faqwZqnWxbxn+F1d399ygeamQNy3lPp/H9H6rNrqYh4FSVCtcY+3cub1MxA8o9mDd55mM8Aghuu/kuyYA6VTsA==", "dev": true }, "capture-exit": { @@ -1817,14 +1865,16 @@ "dev": true }, "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" } }, "chardet": { @@ -2057,9 +2107,9 @@ "dev": true }, "core-js": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.3.tgz", - "integrity": "sha512-l00tmFFZOBHtYhN4Cz7k32VM7vTn3rE2ANjQDxdEN6zmXZ/xq1jQuutnmHvMG1ZJ7xd72+TA5YpUK8wz3rWsfQ==", + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz", + "integrity": "sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY=", "dev": true }, "core-util-is": { @@ -2091,12 +2141,6 @@ "object-assign": "^4.1.1" }, "dependencies": { - "core-js": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz", - "integrity": "sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY=", - "dev": true - }, "fbjs": { "version": "0.8.17", "resolved": "https://registry.npmjs.org/fbjs/-/fbjs-0.8.17.tgz", @@ -2126,9 +2170,9 @@ } }, "cssom": { - "version": "0.3.4", - "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.4.tgz", - "integrity": "sha512-+7prCSORpXNeR4/fUP3rL+TzqtiFfhMvTd7uEqMdgPvLPt4+uzFUeufx5RHjGTACCargg/DiEt/moMQmvnfkog==", + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.6.tgz", + "integrity": "sha512-DtUeseGk9/GBW0hl0vVPpU22iHL6YB5BUX7ml1hB+GMpo0NX5G4voX3kdWiMSEguFtcW3Vh3djqNF4aIe6ne0A==", "dev": true }, "cssstyle": { @@ -2641,9 +2685,9 @@ } }, "expect": { - "version": "24.0.0", - "resolved": "https://registry.npmjs.org/expect/-/expect-24.0.0.tgz", - "integrity": "sha512-qDHRU4lGsme0xjg8dXp/RQhvO9XIo9FWqVo7dTHDPBwzy25JGEHAWFsnpmRYErB50tgi/6euo3ir5e/kF9LUTA==", + "version": "24.1.0", + "resolved": "https://registry.npmjs.org/expect/-/expect-24.1.0.tgz", + "integrity": "sha512-lVcAPhaYkQcIyMS+F8RVwzbm1jro20IG8OkvxQ6f1JfqhVZyyudCwYogQ7wnktlf14iF3ii7ArIUO/mqvrW9Gw==", "dev": true, "requires": { "ansi-styles": "^3.2.0", @@ -2651,6 +2695,17 @@ "jest-matcher-utils": "^24.0.0", "jest-message-util": "^24.0.0", "jest-regex-util": "^24.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + } } }, "extend": { @@ -2809,6 +2864,14 @@ "promise": "^7.1.1", "setimmediate": "^1.0.5", "ua-parser-js": "^0.7.18" + }, + "dependencies": { + "core-js": { + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.4.tgz", + "integrity": "sha512-05qQ5hXShcqGkPZpXEFLIpxayZscVD2kuMBZewxiIPPEagukO4mqgPA9CWhUvFBJfy3ODdK2p9xyHh7FTU9/7A==", + "dev": true + } } }, "fbjs-css-vars": { @@ -2833,6 +2896,14 @@ "plugin-error": "^0.1.2", "semver": "^5.1.0", "through2": "^2.0.0" + }, + "dependencies": { + "core-js": { + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.4.tgz", + "integrity": "sha512-05qQ5hXShcqGkPZpXEFLIpxayZscVD2kuMBZewxiIPPEagukO4mqgPA9CWhUvFBJfy3ODdK2p9xyHh7FTU9/7A==", + "dev": true + } } }, "figures": { @@ -3664,9 +3735,9 @@ } }, "globals": { - "version": "9.18.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", - "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", + "version": "11.11.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.11.0.tgz", + "integrity": "sha512-WHq43gS+6ufNOEqlrDBxVEbb8ntfXrfAUU2ZOpCxrBdGKW3gyv8mCxAfIBD0DroPKGrJ2eSsXsLtY9MPntsyTw==", "dev": true }, "graceful-fs": { @@ -3682,9 +3753,9 @@ "dev": true }, "handlebars": { - "version": "4.0.12", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.0.12.tgz", - "integrity": "sha512-RhmTekP+FZL+XNhwS1Wf+bTTZpdLougwt5pcgA1tuz6Jcx0fpH/7z0qd71RKnZHBCxIRBHfBOnio4gViPemNzA==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.1.0.tgz", + "integrity": "sha512-l2jRuU1NAWK6AW5qqcTATWQJvNPEwkM7NEKSiv/gqOsoSQbVoWyqVEY5GS+XPQ88zLNmqASRpzfdm8d79hJS+w==", "dev": true, "requires": { "async": "^2.5.0", @@ -3926,6 +3997,26 @@ "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "dev": true }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, "strip-ansi": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", @@ -3934,6 +4025,15 @@ "requires": { "ansi-regex": "^3.0.0" } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } } } }, @@ -3984,15 +4084,6 @@ "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", "dev": true }, - "is-builtin-module": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", - "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", - "dev": true, - "requires": { - "builtin-modules": "^1.0.0" - } - }, "is-callable": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", @@ -4205,6 +4296,12 @@ "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", "dev": true }, + "is-wsl": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-1.1.0.tgz", + "integrity": "sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0=", + "dev": true + }, "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", @@ -4385,16 +4482,30 @@ "integrity": "sha512-iB5Dda8t/UqpPI/IjsejXu5jOGDrzn41wJyljwPH65VCIbk6+1BzFIMJGFwTNrYXT1CrD+B4l19U7awiQ8rk7w==", "dev": true }, - "camelcase": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.0.0.tgz", - "integrity": "sha512-faqwZqnWxbxn+F1d399ygeamQNy3lPp/H9H6rNrqYh4FSVCtcY+3cub1MxA8o9mDd55mM8Aghuu/kuyYA6VTsA==", - "dev": true + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } }, "jest-cli": { - "version": "24.0.0", - "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-24.0.0.tgz", - "integrity": "sha512-mElnFipLaGxo1SiQ1CLvuaz3eX07MJc4HcyKrApSJf8xSdY1/EwaHurKwu1g2cDiwIgY8uHj7UcF5OYbtiBOWg==", + "version": "24.1.0", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-24.1.0.tgz", + "integrity": "sha512-U/iyWPwOI0T1CIxVLtk/2uviOTJ/OiSWJSe8qt6X1VkbbgP+nrtLJlmT9lPBe4lK78VNFJtrJ7pttcNv/s7yCw==", "dev": true, "requires": { "ansi-escapes": "^3.0.0", @@ -4409,16 +4520,16 @@ "istanbul-lib-instrument": "^3.0.1", "istanbul-lib-source-maps": "^3.0.1", "jest-changed-files": "^24.0.0", - "jest-config": "^24.0.0", + "jest-config": "^24.1.0", "jest-environment-jsdom": "^24.0.0", "jest-get-type": "^24.0.0", "jest-haste-map": "^24.0.0", "jest-message-util": "^24.0.0", "jest-regex-util": "^24.0.0", - "jest-resolve-dependencies": "^24.0.0", - "jest-runner": "^24.0.0", - "jest-runtime": "^24.0.0", - "jest-snapshot": "^24.0.0", + "jest-resolve-dependencies": "^24.1.0", + "jest-runner": "^24.1.0", + "jest-runtime": "^24.1.0", + "jest-snapshot": "^24.1.0", "jest-util": "^24.0.0", "jest-validate": "^24.0.0", "jest-watcher": "^24.0.0", @@ -4446,6 +4557,15 @@ "ansi-regex": "^4.0.0" } }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, "yargs": { "version": "12.0.5", "resolved": "https://registry.npmjs.org/yargs/-/yargs-12.0.5.tgz", @@ -4465,16 +4585,6 @@ "y18n": "^3.2.1 || ^4.0.0", "yargs-parser": "^11.1.1" } - }, - "yargs-parser": { - "version": "11.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-11.1.1.tgz", - "integrity": "sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ==", - "dev": true, - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } } } }, @@ -4489,27 +4599,26 @@ } }, "jest-config": { - "version": "24.0.0", - "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-24.0.0.tgz", - "integrity": "sha512-9/soqWL5YSq1ZJtgVJ5YYPCL1f9Mi2lVCp5+OXuYBOaN8DHSFRCSWip0rQ6N+mPTOEIAlCvcUH8zaPOwK4hePg==", + "version": "24.1.0", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-24.1.0.tgz", + "integrity": "sha512-FbbRzRqtFC6eGjG5VwsbW4E5dW3zqJKLWYiZWhB0/4E5fgsMw8GODLbGSrY5t17kKOtCWb/Z7nsIThRoDpuVyg==", "dev": true, "requires": { "@babel/core": "^7.1.0", - "babel-jest": "^24.0.0", + "babel-jest": "^24.1.0", "chalk": "^2.0.1", "glob": "^7.1.1", "jest-environment-jsdom": "^24.0.0", "jest-environment-node": "^24.0.0", "jest-get-type": "^24.0.0", - "jest-jasmine2": "^24.0.0", + "jest-jasmine2": "^24.1.0", "jest-regex-util": "^24.0.0", - "jest-resolve": "^24.0.0", + "jest-resolve": "^24.1.0", "jest-util": "^24.0.0", "jest-validate": "^24.0.0", "micromatch": "^3.1.10", "pretty-format": "^24.0.0", - "realpath-native": "^1.0.2", - "uuid": "^3.3.2" + "realpath-native": "^1.0.2" }, "dependencies": { "ansi-regex": { @@ -4518,6 +4627,26 @@ "integrity": "sha512-iB5Dda8t/UqpPI/IjsejXu5jOGDrzn41wJyljwPH65VCIbk6+1BzFIMJGFwTNrYXT1CrD+B4l19U7awiQ8rk7w==", "dev": true }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, "pretty-format": { "version": "24.0.0", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-24.0.0.tgz", @@ -4527,6 +4656,15 @@ "ansi-regex": "^4.0.0", "ansi-styles": "^3.2.0" } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } } } }, @@ -4548,6 +4686,26 @@ "integrity": "sha512-iB5Dda8t/UqpPI/IjsejXu5jOGDrzn41wJyljwPH65VCIbk6+1BzFIMJGFwTNrYXT1CrD+B4l19U7awiQ8rk7w==", "dev": true }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, "pretty-format": { "version": "24.0.0", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-24.0.0.tgz", @@ -4557,6 +4715,15 @@ "ansi-regex": "^4.0.0", "ansi-styles": "^3.2.0" } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } } } }, @@ -4587,6 +4754,26 @@ "integrity": "sha512-iB5Dda8t/UqpPI/IjsejXu5jOGDrzn41wJyljwPH65VCIbk6+1BzFIMJGFwTNrYXT1CrD+B4l19U7awiQ8rk7w==", "dev": true }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, "pretty-format": { "version": "24.0.0", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-24.0.0.tgz", @@ -4596,6 +4783,15 @@ "ansi-regex": "^4.0.0", "ansi-styles": "^3.2.0" } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } } } }, @@ -4643,22 +4839,23 @@ } }, "jest-jasmine2": { - "version": "24.0.0", - "resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-24.0.0.tgz", - "integrity": "sha512-q1xEV9KHM0bgfBj3yrkrjRF5kxpNDkWPCwVfSPN1DC+pD6J5wrM9/u2BgzhKhALXiaZUUhJ+f/OcEC0Gwpw90A==", + "version": "24.1.0", + "resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-24.1.0.tgz", + "integrity": "sha512-H+o76SdSNyCh9fM5K8upK45YTo/DiFx5w2YAzblQebSQmukDcoVBVeXynyr7DDnxh+0NTHYRCLwJVf3tC518wg==", "dev": true, "requires": { "@babel/traverse": "^7.1.0", "chalk": "^2.0.1", "co": "^4.6.0", - "expect": "^24.0.0", + "expect": "^24.1.0", "is-generator-fn": "^2.0.0", "jest-each": "^24.0.0", "jest-matcher-utils": "^24.0.0", "jest-message-util": "^24.0.0", - "jest-snapshot": "^24.0.0", + "jest-snapshot": "^24.1.0", "jest-util": "^24.0.0", - "pretty-format": "^24.0.0" + "pretty-format": "^24.0.0", + "throat": "^4.0.0" }, "dependencies": { "ansi-regex": { @@ -4667,6 +4864,26 @@ "integrity": "sha512-iB5Dda8t/UqpPI/IjsejXu5jOGDrzn41wJyljwPH65VCIbk6+1BzFIMJGFwTNrYXT1CrD+B4l19U7awiQ8rk7w==", "dev": true }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, "pretty-format": { "version": "24.0.0", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-24.0.0.tgz", @@ -4676,10 +4893,19 @@ "ansi-regex": "^4.0.0", "ansi-styles": "^3.2.0" } - } - } - }, - "jest-junit": { + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "jest-junit": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/jest-junit/-/jest-junit-5.2.0.tgz", "integrity": "sha512-Mdg0Qpdh1Xm/FA1B/mcLlmEmlr3XzH5pZg7MvcAwZhjHijPRd1z/UwYwkwNHmCV7o4ZOWCf77nLu7ZkhHHrtJg==", @@ -4698,6 +4924,15 @@ "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "dev": true }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, "arr-diff": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", @@ -4768,6 +5003,17 @@ "integrity": "sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA=", "dev": true }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, "ci-info": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-1.6.0.tgz", @@ -5220,6 +5466,15 @@ "is-utf8": "^0.2.0" } }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, "test-exclude": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-4.2.3.tgz", @@ -5250,6 +5505,15 @@ "integrity": "sha512-iB5Dda8t/UqpPI/IjsejXu5jOGDrzn41wJyljwPH65VCIbk6+1BzFIMJGFwTNrYXT1CrD+B4l19U7awiQ8rk7w==", "dev": true }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, "pretty-format": { "version": "24.0.0", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-24.0.0.tgz", @@ -5280,6 +5544,26 @@ "integrity": "sha512-iB5Dda8t/UqpPI/IjsejXu5jOGDrzn41wJyljwPH65VCIbk6+1BzFIMJGFwTNrYXT1CrD+B4l19U7awiQ8rk7w==", "dev": true }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, "pretty-format": { "version": "24.0.0", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-24.0.0.tgz", @@ -5289,6 +5573,15 @@ "ansi-regex": "^4.0.0", "ansi-styles": "^3.2.0" } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } } } }, @@ -5303,6 +5596,37 @@ "micromatch": "^3.1.10", "slash": "^2.0.0", "stack-utils": "^1.0.1" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } } }, "jest-mock": { @@ -5318,51 +5642,114 @@ "dev": true }, "jest-resolve": { - "version": "24.0.0", - "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-24.0.0.tgz", - "integrity": "sha512-uKDGyJqNaBQKox1DJzm27CJobADsIMNgZGusXhtYzl98LKu/fKuokkRsd7EBVgoDA80HKHc3LOPKuYLryMu1vw==", + "version": "24.1.0", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-24.1.0.tgz", + "integrity": "sha512-TPiAIVp3TG6zAxH28u/6eogbwrvZjBMWroSLBDkwkHKrqxB/RIdwkWDye4uqPlZIXWIaHtifY3L0/eO5Z0f2wg==", "dev": true, "requires": { "browser-resolve": "^1.11.3", "chalk": "^2.0.1", "realpath-native": "^1.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } } }, "jest-resolve-dependencies": { - "version": "24.0.0", - "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-24.0.0.tgz", - "integrity": "sha512-CJGS5ME2g5wL16o3Y22ga9p5ntNT5CUYX40/0lYj9ic9jB5YHm/qMKTgbFt9kowEBiMOFpXy15dWtBTEU54+zg==", + "version": "24.1.0", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-24.1.0.tgz", + "integrity": "sha512-2VwPsjd3kRPu7qe2cpytAgowCObk5AKeizfXuuiwgm1a9sijJDZe8Kh1sFj6FKvSaNEfCPlBVkZEJa2482m/Uw==", "dev": true, "requires": { "jest-regex-util": "^24.0.0", - "jest-snapshot": "^24.0.0" + "jest-snapshot": "^24.1.0" } }, "jest-runner": { - "version": "24.0.0", - "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-24.0.0.tgz", - "integrity": "sha512-XefXm2XimKtwdfi2am4364GfCmLD1tOjiRtDexY65diCXt4Rw23rxj2wiW7p9s8Nh9dzJQNmrheqZ5rzvn762g==", + "version": "24.1.0", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-24.1.0.tgz", + "integrity": "sha512-CDGOkT3AIFl16BLL/OdbtYgYvbAprwJ+ExKuLZmGSCSldwsuU2dEGauqkpvd9nphVdAnJUcP12e/EIlnTX0QXg==", "dev": true, "requires": { + "chalk": "^2.4.2", "exit": "^0.1.2", "graceful-fs": "^4.1.15", - "jest-config": "^24.0.0", + "jest-config": "^24.1.0", "jest-docblock": "^24.0.0", "jest-haste-map": "^24.0.0", - "jest-jasmine2": "^24.0.0", + "jest-jasmine2": "^24.1.0", "jest-leak-detector": "^24.0.0", "jest-message-util": "^24.0.0", - "jest-runtime": "^24.0.0", + "jest-runtime": "^24.1.0", "jest-util": "^24.0.0", "jest-worker": "^24.0.0", "source-map-support": "^0.5.6", "throat": "^4.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } } }, "jest-runtime": { - "version": "24.0.0", - "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-24.0.0.tgz", - "integrity": "sha512-UeVoTGiij8upcqfyBlJvImws7IGY+ZWtgVpt1h4VmVbyei39tVGia/20VoP3yvodS6FdjTwBj+JzVNuoh/9UTw==", + "version": "24.1.0", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-24.1.0.tgz", + "integrity": "sha512-59/BY6OCuTXxGeDhEMU7+N33dpMQyXq7MLK07cNSIY/QYt2QZgJ7Tjx+rykBI0skAoigFl0A5tmT8UdwX92YuQ==", "dev": true, "requires": { "@babel/core": "^7.1.0", @@ -5373,27 +5760,50 @@ "fast-json-stable-stringify": "^2.0.0", "glob": "^7.1.3", "graceful-fs": "^4.1.15", - "jest-config": "^24.0.0", + "jest-config": "^24.1.0", "jest-haste-map": "^24.0.0", "jest-message-util": "^24.0.0", "jest-regex-util": "^24.0.0", - "jest-resolve": "^24.0.0", - "jest-snapshot": "^24.0.0", + "jest-resolve": "^24.1.0", + "jest-snapshot": "^24.1.0", "jest-util": "^24.0.0", "jest-validate": "^24.0.0", "micromatch": "^3.1.10", "realpath-native": "^1.0.0", "slash": "^2.0.0", - "strip-bom": "3.0.0", - "write-file-atomic": "^2.4.2", + "strip-bom": "^3.0.0", + "write-file-atomic": "2.4.1", "yargs": "^12.0.2" }, "dependencies": { - "camelcase": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.0.0.tgz", - "integrity": "sha512-faqwZqnWxbxn+F1d399ygeamQNy3lPp/H9H6rNrqYh4FSVCtcY+3cub1MxA8o9mDd55mM8Aghuu/kuyYA6VTsA==", - "dev": true + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } }, "yargs": { "version": "12.0.5", @@ -5414,16 +5824,6 @@ "y18n": "^3.2.1 || ^4.0.0", "yargs-parser": "^11.1.1" } - }, - "yargs-parser": { - "version": "11.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-11.1.1.tgz", - "integrity": "sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ==", - "dev": true, - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } } } }, @@ -5434,9 +5834,9 @@ "dev": true }, "jest-snapshot": { - "version": "24.0.0", - "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-24.0.0.tgz", - "integrity": "sha512-7OcrckVnfzVYxSGPYl2Sn+HyT30VpDv+FMBFbQxSQ6DV2K9Js6vYT6d4SBPKp6DfDiEL2txNssJBxtlvF+Dymw==", + "version": "24.1.0", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-24.1.0.tgz", + "integrity": "sha512-th6TDfFqEmXvuViacU1ikD7xFb7lQsPn2rJl7OEmnfIVpnrx3QNY2t3PE88meeg0u/mQ0nkyvmC05PBqO4USFA==", "dev": true, "requires": { "@babel/types": "^7.0.0", @@ -5444,7 +5844,7 @@ "jest-diff": "^24.0.0", "jest-matcher-utils": "^24.0.0", "jest-message-util": "^24.0.0", - "jest-resolve": "^24.0.0", + "jest-resolve": "^24.1.0", "mkdirp": "^0.5.1", "natural-compare": "^1.4.0", "pretty-format": "^24.0.0", @@ -5457,6 +5857,26 @@ "integrity": "sha512-iB5Dda8t/UqpPI/IjsejXu5jOGDrzn41wJyljwPH65VCIbk6+1BzFIMJGFwTNrYXT1CrD+B4l19U7awiQ8rk7w==", "dev": true }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, "pretty-format": { "version": "24.0.0", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-24.0.0.tgz", @@ -5466,6 +5886,15 @@ "ansi-regex": "^4.0.0", "ansi-styles": "^3.2.0" } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } } } }, @@ -5485,11 +5914,40 @@ "source-map": "^0.6.0" }, "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } } } }, @@ -5512,11 +5970,25 @@ "integrity": "sha512-iB5Dda8t/UqpPI/IjsejXu5jOGDrzn41wJyljwPH65VCIbk6+1BzFIMJGFwTNrYXT1CrD+B4l19U7awiQ8rk7w==", "dev": true }, - "camelcase": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.0.0.tgz", - "integrity": "sha512-faqwZqnWxbxn+F1d399ygeamQNy3lPp/H9H6rNrqYh4FSVCtcY+3cub1MxA8o9mDd55mM8Aghuu/kuyYA6VTsA==", - "dev": true + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } }, "pretty-format": { "version": "24.0.0", @@ -5527,6 +5999,15 @@ "ansi-regex": "^4.0.0", "ansi-styles": "^3.2.0" } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } } } }, @@ -5540,6 +6021,37 @@ "chalk": "^2.0.1", "jest-util": "^24.0.0", "string-length": "^2.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } } }, "jest-worker": { @@ -5570,9 +6082,9 @@ "dev": true }, "js-tokens": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", - "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", "dev": true }, "js-yaml": { @@ -5727,9 +6239,9 @@ } }, "kleur": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.1.tgz", - "integrity": "sha512-P3kRv+B+Ra070ng2VKQqW4qW7gd/v3iD8sy/zOdcYRsfiD+QBokQNOps/AfP6Hr48cBhIIBFWckB9aO+IZhrWg==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.2.tgz", + "integrity": "sha512-3h7B2WRT5LNXOtQiAaWonilegHcPSf9nLVXlSTci8lu1dZUuui61+EsPEZqSVxY7rXYmB2DVKMQILxaO5WL61Q==", "dev": true }, "lcid": { @@ -5977,12 +6489,6 @@ "yargs": "^9.0.0" }, "dependencies": { - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true - }, "arr-diff": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", @@ -6009,19 +6515,6 @@ "repeat-element": "^1.1.2" } }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dev": true, - "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - } - }, "expand-brackets": { "version": "0.1.5", "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", @@ -6109,12 +6602,6 @@ "mime-db": "~1.23.0" } }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true - }, "wordwrap": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", @@ -6152,6 +6639,14 @@ "@babel/register": "^7.0.0", "core-js": "^2.2.2", "escape-string-regexp": "^1.0.5" + }, + "dependencies": { + "core-js": { + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.4.tgz", + "integrity": "sha512-05qQ5hXShcqGkPZpXEFLIpxayZscVD2kuMBZewxiIPPEagukO4mqgPA9CWhUvFBJfy3ODdK2p9xyHh7FTU9/7A==", + "dev": true + } } }, "metro-babel7-plugin-react-transform": { @@ -6669,25 +7164,26 @@ "dev": true }, "node-notifier": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-5.3.0.tgz", - "integrity": "sha512-AhENzCSGZnZJgBARsUjnQ7DnZbzyP+HxlVXuD0xqAnvL8q+OqtSX7lGg9e8nHzwXkMMXNdVeqq4E2M3EUAqX6Q==", + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-5.4.0.tgz", + "integrity": "sha512-SUDEb+o71XR5lXSTyivXd9J7fCloE3SyP4lSgt3lU2oSANiox+SxlNRGPjDKrwU1YN3ix2KN/VGGCg0t01rttQ==", "dev": true, "requires": { "growly": "^1.3.0", + "is-wsl": "^1.1.0", "semver": "^5.5.0", "shellwords": "^0.1.1", "which": "^1.3.0" } }, "normalize-package-data": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.2.tgz", - "integrity": "sha512-YcMnjqeoUckXTPKZSAsPjUPLxH85XotbpqK3w4RyCwdFQSU5FxxBys8buehkSfg0j9fKvV1hn7O0+8reEgkAiw==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", "dev": true, "requires": { "hosted-git-info": "^2.1.4", - "is-builtin-module": "^1.0.0", + "resolve": "^1.10.0", "semver": "2 || 3 || 4 || 5", "validate-npm-package-license": "^3.0.1" } @@ -6734,9 +7230,9 @@ "dev": true }, "nwsapi": { - "version": "2.0.9", - "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.0.9.tgz", - "integrity": "sha512-nlWFSCTYQcHk/6A9FFnfhKc14c3aFhfdNBXgo8Qgi9QTBu/qg3Ww+Uiz9wMzXd1T8GFxPc2QIHB6Qtf2XFryFQ==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.1.0.tgz", + "integrity": "sha512-ZG3bLAvdHmhIjaQ/Db1qvBxsGvFMLIRpQszyqbg31VJ53UP++uZX1/gf3Ut96pdwN9AuDwlMqIYLm0UPCdUeHg==", "dev": true }, "oauth-sign": { @@ -6783,9 +7279,9 @@ } }, "object-keys": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.12.tgz", - "integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.0.tgz", + "integrity": "sha512-6OO5X1+2tYkNyNEx6TsCxEqFfRWaqx6EtMiSbGrw8Ob8v9Ne+Hl8rBAgLBZn5wjEz3s/s6U1WXFUFOcxxAwUpg==", "dev": true }, "object-visit": { @@ -7181,6 +7677,15 @@ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.0.0.tgz", "integrity": "sha512-iB5Dda8t/UqpPI/IjsejXu5jOGDrzn41wJyljwPH65VCIbk6+1BzFIMJGFwTNrYXT1CrD+B4l19U7awiQ8rk7w==", "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } } } }, @@ -7212,23 +7717,23 @@ } }, "prompts": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.0.1.tgz", - "integrity": "sha512-8lnEOSIGQbgbnO47+13S+H204L8ISogGulyi0/NNEFAQ9D1VMNTrJ9SBX2Ra03V4iPn/zt36HQMndRYkaPoWiQ==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.0.2.tgz", + "integrity": "sha512-Pc/c53d2WZHJWZr78/BhZ5eHsdQtltbyBjHoA4T0cs/4yKJqCcoOHrq2SNKwtspVE0C+ebqAR5u0/mXwrHaADQ==", "dev": true, "requires": { - "kleur": "^3.0.0", + "kleur": "^3.0.2", "sisteransi": "^1.0.0" } }, "prop-types": { - "version": "15.6.2", - "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.6.2.tgz", - "integrity": "sha512-3pboPvLiWD7dkI3qf3KbUe6hKFKa52w+AE0VCqECtf+QHAKgOL37tTaNCnuX1nAAQ4ZhyP+kYVKf8rLmJ/feDQ==", + "version": "15.7.1", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.7.1.tgz", + "integrity": "sha512-f8Lku2z9kERjOCcnDOPm68EBJAO2K00Q5mSgPAUE/gJuBgsYLbVy6owSrtcHj90zt8PvW+z0qaIIgsIhHOa1Qw==", "dev": true, "requires": { - "loose-envify": "^1.3.1", - "object-assign": "^4.1.1" + "object-assign": "^4.1.1", + "react-is": "^16.8.1" } }, "pseudomap": { @@ -7349,6 +7854,12 @@ } } }, + "react-is": { + "version": "16.8.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.8.1.tgz", + "integrity": "sha512-ioMCzVDWvCvKD8eeT+iukyWrBGrA3DiFYkXfBsVYIRdaREZuBjENG+KjrikavCLasozqRWTwFUagU/O4vPpRMA==", + "dev": true + }, "react-native": { "version": "0.58.3", "resolved": "https://registry.npmjs.org/react-native/-/react-native-0.58.3.tgz", @@ -7410,33 +7921,6 @@ "xcode": "^1.0.0", "xmldoc": "^0.4.0", "yargs": "^9.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true - }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dev": true, - "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - } - }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true - } } }, "react-native-typescript-transformer": { @@ -7451,6 +7935,37 @@ "jju": "^1.3.0", "semver": "^5.4.1", "source-map": "^0.5.6" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } } }, "react-proxy": { @@ -8440,13 +8955,10 @@ "dev": true }, "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true }, "symbol-tree": { "version": "3.2.2", @@ -8473,9 +8985,9 @@ } }, "test-exclude": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-5.0.0.tgz", - "integrity": "sha512-bO3Lj5+qFa9YLfYW2ZcXMOV1pmQvw+KS/DpjqhyX6Y6UZ8zstpZJ+mA2ERkXfpOqhxsJlQiLeVXD3Smsrs6oLw==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-5.1.0.tgz", + "integrity": "sha512-gwf0S2fFsANC55fSeSqpb8BYk6w3FDvwZxfNjeF6FRgvFa43r+7wRiA/Q0IxoRU37wB/LE8IQ4221BsNucTaCA==", "dev": true, "requires": { "arrify": "^1.0.1", @@ -8528,9 +9040,9 @@ "dev": true }, "to-fast-properties": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz", - "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", "dev": true }, "to-object-path": { @@ -8636,6 +9148,23 @@ "resolve": "1.x", "semver": "^5.5", "yargs-parser": "10.x" + }, + "dependencies": { + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + }, + "yargs-parser": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-10.1.0.tgz", + "integrity": "sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ==", + "dev": true, + "requires": { + "camelcase": "^4.1.0" + } + } } }, "tslib": { @@ -8663,11 +9192,34 @@ "tsutils": "^2.27.2" }, "dependencies": { - "tslib": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz", - "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==", - "dev": true + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } } } }, @@ -8678,14 +9230,6 @@ "dev": true, "requires": { "tslib": "^1.8.1" - }, - "dependencies": { - "tslib": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz", - "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==", - "dev": true - } } }, "tunnel-agent": { @@ -8719,9 +9263,9 @@ "dev": true }, "typescript": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.2.4.tgz", - "integrity": "sha512-0RNDbSdEokBeEAkgNbxJ+BLwSManFy9TeXz8uW+48j/xhEXv1ePME60olyzw2XzUqUBNAYFeJadIqAgNqIACwg==", + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.3.3.tgz", + "integrity": "sha512-Y21Xqe54TBVp+VDSNbuDYdGw0BpoR/Q6wo/+35M8PAU0vipahnyduJWirxxdxjsAkS7hue53x2zp8gz7F05u0A==", "dev": true }, "ua-parser-js": { @@ -9080,9 +9624,9 @@ "dev": true }, "write-file-atomic": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.4.2.tgz", - "integrity": "sha512-s0b6vB3xIVRLWywa6X9TOMA7k9zio0TMOsl9ZnDkliA/cfJlpHXAscj0gbHVJiTdIuAYpIyqS5GW91fqm6gG5g==", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.4.1.tgz", + "integrity": "sha512-TGHFeZEZMnv+gBFRfjAcxL5bPHrsGKtnb4qsFAws7/vlh+QfwAaySIw4AXP9ZskTTh5GWu3FLuJhsWVdiJPGvg==", "dev": true, "requires": { "graceful-fs": "^4.1.11", @@ -9196,6 +9740,12 @@ "yargs-parser": "^7.0.0" }, "dependencies": { + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + }, "cliui": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", @@ -9403,12 +9953,13 @@ } }, "yargs-parser": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-10.1.0.tgz", - "integrity": "sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ==", + "version": "11.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-11.1.1.tgz", + "integrity": "sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ==", "dev": true, "requires": { - "camelcase": "^4.1.0" + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" } } }