agora-electron-sdk 3.4.1 → 3.4.2-build.706

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,5 @@
1
+ ## 3.4.2-build.706 (July 16th, 2022)
2
+ videoSourceSetAddonLogFile
1
3
  ## 3.4.1 (April 26st, 2021)
2
4
  * add new api:
3
5
  - adjustLoopbackRecordingSignalVolume
Binary file
@@ -14,7 +14,6 @@
14
14
  using v8::Object;
15
15
  using agora::rtc::NodeRtcEngine;
16
16
 
17
- LogHelper g_logHelper("./agoraAddonlog.txt");
18
17
 
19
18
  /**
20
19
  * Initialize NODEJS ADDON
@@ -22,6 +21,7 @@ LogHelper g_logHelper("./agoraAddonlog.txt");
22
21
  void InitExt(Local<Object> module)
23
22
  {
24
23
  LOG_ENTER;
24
+ LogHelper::getInstance("./agoraAddonlog.txt");
25
25
  NodeRtcEngine::Init(module);
26
26
  LOG_LEAVE;
27
27
  }
@@ -13,6 +13,7 @@
13
13
  #include "node_uid.h"
14
14
  #include "agora_video_source.h"
15
15
  #include "node_napi_api.h"
16
+ #include "log_helper.h"
16
17
  #include "IAgoraRtcEngine2.h"
17
18
  #include <string>
18
19
  #include <nan.h>
@@ -193,6 +194,7 @@ namespace agora {
193
194
  PROPERTY_METHOD_DEFINE(videoSourceEnableEncryption)
194
195
  PROPERTY_METHOD_DEFINE(videoSourceSetEncryptionMode)
195
196
  PROPERTY_METHOD_DEFINE(videoSourceSetEncryptionSecret);
197
+ PROPERTY_METHOD_DEFINE(videoSourceSetAddonLogFile);
196
198
  PROPERTY_METHOD_DEFINE(setBool);
197
199
  PROPERTY_METHOD_DEFINE(setInt);
198
200
  PROPERTY_METHOD_DEFINE(setUInt);
@@ -321,6 +323,11 @@ namespace agora {
321
323
  PROPERTY_METHOD_DEFINE(getAudioMixingFileDuration);
322
324
  PROPERTY_METHOD_DEFINE(setProcessDpiAwareness);
323
325
  PROPERTY_METHOD_DEFINE(videoSourceSetProcessDpiAwareness);
326
+ PROPERTY_METHOD_DEFINE(startAudioRecordingWithConfig);
327
+ /**
328
+ * setAddonLogFile
329
+ */
330
+ PROPERTY_METHOD_DEFINE(setAddonLogFile);
324
331
  EN_PROPERTY_DEFINE()
325
332
  module->Set(context, Nan::New<v8::String>("NodeRtcEngine").ToLocalChecked(), tpl->GetFunction(context).ToLocalChecked());
326
333
  }
@@ -2550,6 +2557,29 @@ namespace agora {
2550
2557
  LOG_LEAVE;
2551
2558
  }
2552
2559
 
2560
+ NAPI_API_DEFINE(NodeRtcEngine, videoSourceSetAddonLogFile)
2561
+ {
2562
+ LOG_ENTER;
2563
+ napi_status status = napi_ok;
2564
+ int result = -1;
2565
+ do{
2566
+ NodeRtcEngine *pEngine = nullptr;
2567
+ napi_get_native_this(args, pEngine);
2568
+ CHECK_NATIVE_THIS(pEngine);
2569
+ nodestring path;
2570
+ napi_get_param_1(args, nodestring, path);
2571
+ string sPath;
2572
+ sPath = path ? string(path) : "";
2573
+
2574
+ if (!pEngine->m_videoSourceSink.get() || pEngine->m_videoSourceSink->setAddonLogFile(sPath.c_str()) != node_ok) {
2575
+ break;
2576
+ }
2577
+ result = 0;
2578
+ } while (false);
2579
+ napi_set_int_result(args, result);
2580
+ LOG_LEAVE;
2581
+ }
2582
+
2553
2583
  NAPI_API_DEFINE(NodeRtcEngine, leaveChannel)
2554
2584
  {
2555
2585
  LOG_ENTER;
@@ -3546,13 +3576,13 @@ namespace agora {
3546
3576
  napi_status status = napi_ok;
3547
3577
  NodeString filepath;
3548
3578
  bool loopback, replace;
3549
- int cycle;
3579
+ int cycle, startPos = 0;
3550
3580
  napi_get_native_this(args, pEngine);
3551
3581
  CHECK_NATIVE_THIS(pEngine);
3552
- napi_get_param_4(args, nodestring, filepath, bool, loopback, bool, replace, int32, cycle);
3582
+ napi_get_param_5(args, nodestring, filepath, bool, loopback, bool, replace, int32, cycle, int32, startPos);
3553
3583
  CHECK_NAPI_STATUS(pEngine, status);
3554
3584
  RtcEngineParameters rep(pEngine->m_engine);
3555
- result = rep.startAudioMixing(filepath, loopback, replace, cycle);
3585
+ result = rep.startAudioMixing(filepath, loopback, replace, cycle, startPos);
3556
3586
  } while (false);
3557
3587
  napi_set_int_result(args, result);
3558
3588
  LOG_LEAVE;
@@ -6079,13 +6109,13 @@ namespace agora {
6079
6109
  napi_get_native_this(args, pEngine);
6080
6110
  CHECK_NATIVE_THIS(pEngine);
6081
6111
  NodeString filePath;
6082
- unsigned int soundId, loopCount, gain, startPos;
6112
+ unsigned int soundId, loopCount, gain, startPos = 0;
6083
6113
  double pitch, pan;
6084
6114
  bool publish;
6085
6115
 
6086
6116
  napi_get_param_8(args, uint32, soundId, nodestring, filePath, uint32, loopCount, double, pitch, double, pan, uint32, gain, bool, publish, uint32, startPos);
6087
-
6088
- result = pEngine->m_engine->getEffectCurrentPosition(soundId);
6117
+
6118
+ result = pEngine->m_engine->playEffect(soundId, filePath, loopCount, pitch, pan, gain, publish, startPos);
6089
6119
  } while (false);
6090
6120
  napi_set_int_result(args, result);
6091
6121
 
@@ -6126,6 +6156,70 @@ namespace agora {
6126
6156
 
6127
6157
  LOG_LEAVE;
6128
6158
  }
6159
+
6160
+ NAPI_API_DEFINE(NodeRtcEngine, startAudioRecordingWithConfig)
6161
+ {
6162
+ LOG_ENTER;
6163
+ int result = -1;
6164
+ do {
6165
+ NodeRtcEngine *pEngine = nullptr;
6166
+ napi_status status = napi_ok;
6167
+ Isolate *isolate = args.GetIsolate();
6168
+ napi_get_native_this(args, pEngine);
6169
+ CHECK_NATIVE_THIS(pEngine);
6170
+ if(args[0]->IsObject()) {
6171
+ Local<Object> obj;
6172
+ status = napi_get_value_object_(isolate, args[0], obj);
6173
+ CHECK_NAPI_STATUS(pEngine, status);
6174
+ NodeString filePath;
6175
+ napi_get_object_property_nodestring_(isolate, obj, "filePath", filePath);
6176
+ CHECK_NAPI_STATUS(pEngine, status);
6177
+
6178
+ int recordingQuality;
6179
+ napi_get_object_property_int32_(isolate, obj, "recordingQuality", recordingQuality);
6180
+ CHECK_NAPI_STATUS(pEngine, status);
6181
+
6182
+ int recordingPosition;
6183
+ napi_get_object_property_int32_(isolate, obj, "recordingPosition", recordingPosition);
6184
+ CHECK_NAPI_STATUS(pEngine, status);
6185
+
6186
+ int recordingSampleRate;
6187
+ napi_get_object_property_int32_(isolate, obj, "recordingSampleRate", recordingSampleRate);
6188
+ CHECK_NAPI_STATUS(pEngine, status);
6189
+
6190
+ AudioRecordingConfiguration config;
6191
+ config.filePath = (char *)filePath;
6192
+ config.recordingQuality = (AUDIO_RECORDING_QUALITY_TYPE)recordingQuality;
6193
+ config.recordingPosition = (AUDIO_RECORDING_POSITION)recordingPosition;
6194
+ config.recordingSampleRate = recordingSampleRate;
6195
+ result = pEngine->m_engine->startAudioRecording(config);
6196
+ }
6197
+
6198
+ } while (false);
6199
+ napi_set_int_result(args, result);
6200
+
6201
+ LOG_LEAVE;
6202
+ }
6203
+
6204
+ NAPI_API_DEFINE(NodeRtcEngine, setAddonLogFile)
6205
+ {
6206
+ LOG_ENTER;
6207
+ napi_status status = napi_ok;
6208
+ int result = -1;
6209
+ do{
6210
+ NodeRtcEngine *pEngine = nullptr;
6211
+ napi_get_native_this(args, pEngine);
6212
+ CHECK_NATIVE_THIS(pEngine);
6213
+ nodestring path;
6214
+ napi_get_param_1(args, nodestring, path);
6215
+ string sPath;
6216
+ sPath = path ? string(path) : "";
6217
+
6218
+ result = LogHelper::getInstance()->setAddonLogPath(sPath.c_str());
6219
+ } while (false);
6220
+ napi_set_int_result(args, result);
6221
+ LOG_LEAVE;
6222
+ }
6129
6223
  /**
6130
6224
  * NodeRtcChannel
6131
6225
  */
@@ -253,6 +253,7 @@ namespace agora {
253
253
  NAPI_API(videoSourceEnableEncryption);
254
254
  NAPI_API(videoSourceSetEncryptionMode);
255
255
  NAPI_API(videoSourceSetEncryptionSecret);
256
+ NAPI_API(videoSourceSetAddonLogFile);
256
257
  /*
257
258
  * Native interface used to setup local and remote video canvas.
258
259
  */
@@ -381,6 +382,12 @@ namespace agora {
381
382
 
382
383
  NAPI_API(setProcessDpiAwareness);
383
384
  NAPI_API(videoSourceSetProcessDpiAwareness);
385
+
386
+ NAPI_API(startAudioRecordingWithConfig);
387
+ /*
388
+ * setAddonLogFile
389
+ */
390
+ NAPI_API(setAddonLogFile);
384
391
 
385
392
  public:
386
393
  Isolate* getIsolate() { return m_isolate; }
@@ -569,6 +576,33 @@ namespace agora {
569
576
  } \
570
577
  } while (false);
571
578
 
579
+ /*
580
+ * to extract four parameters from JS call parameters.
581
+ */
582
+ #define napi_get_param_5(argv, type1, param1, type2, param2, type3, param3, type4, param4, type5, param5) \
583
+ do { \
584
+ status = napi_get_value_##type1##_(argv[0], (param1)); \
585
+ if(status != napi_ok) { \
586
+ break; \
587
+ } \
588
+ status = napi_get_value_##type2##_(argv[1], (param2)); \
589
+ if(status != napi_ok) { \
590
+ break; \
591
+ } \
592
+ status = napi_get_value_##type3##_(argv[2], (param3)); \
593
+ if(status != napi_ok) { \
594
+ break; \
595
+ } \
596
+ status = napi_get_value_##type4##_(argv[3], (param4)); \
597
+ if(status != napi_ok) { \
598
+ break; \
599
+ } \
600
+ status = napi_get_value_##type5##_(argv[4], (param5)); \
601
+ if(status != napi_ok) { \
602
+ break; \
603
+ } \
604
+ } while (false);
605
+
572
606
  /*
573
607
  * to extract seven parameters from JS call parameters.
574
608
  */