@clarionhq/recorder 0.0.1 → 0.1.1
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/LICENSE +21 -0
- package/README.md +110 -0
- package/android/CMakeLists.txt +9 -0
- package/android/build.gradle +97 -0
- package/android/gradle.properties +4 -0
- package/android/proguard-rules.pro +1 -0
- package/android/src/main/AndroidManifest.xml +4 -0
- package/android/src/main/cpp/cpp-adapter.cpp +7 -0
- package/android/src/main/java/com/clarionhq/recorder/AudioLevelMeter.kt +38 -0
- package/android/src/main/java/com/clarionhq/recorder/ClarionRecorderPackage.kt +27 -0
- package/android/src/main/java/com/clarionhq/recorder/EncodeFile.kt +62 -0
- package/android/src/main/java/com/clarionhq/recorder/RecorderConfig.kt +33 -0
- package/android/src/main/java/com/clarionhq/recorder/RecorderConstants.kt +16 -0
- package/android/src/main/java/com/clarionhq/recorder/RecorderSession.kt +336 -0
- package/android/src/main/java/com/clarionhq/recorder/RecorderTypes.kt +29 -0
- package/android/src/main/java/com/margelo/nitro/clarion/recorder/HybridClarionRecorder.kt +174 -0
- package/clarionhq-recorder.podspec +31 -0
- package/ios/AudioLevelMeter.swift +37 -0
- package/ios/EncodeFile.swift +69 -0
- package/ios/HybridClarionRecorder.swift +186 -0
- package/ios/RecorderConstants.swift +11 -0
- package/ios/RecorderSession.swift +278 -0
- package/ios/RecorderTypes.swift +41 -0
- package/lib/RecorderEngine.d.ts +31 -0
- package/lib/RecorderEngine.d.ts.map +1 -0
- package/lib/RecorderEngine.js +245 -0
- package/lib/RecorderEngine.js.map +1 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -0
- package/lib/native.d.ts +3 -0
- package/lib/native.d.ts.map +1 -0
- package/lib/native.js +3 -0
- package/lib/native.js.map +1 -0
- package/lib/specs/ClarionRecorder.nitro.d.ts +49 -0
- package/lib/specs/ClarionRecorder.nitro.d.ts.map +1 -0
- package/lib/specs/ClarionRecorder.nitro.js +2 -0
- package/lib/specs/ClarionRecorder.nitro.js.map +1 -0
- package/nitro.json +24 -0
- package/nitrogen/generated/android/ClarionRecorder+autolinking.cmake +81 -0
- package/nitrogen/generated/android/ClarionRecorder+autolinking.gradle +27 -0
- package/nitrogen/generated/android/ClarionRecorderOnLoad.cpp +62 -0
- package/nitrogen/generated/android/ClarionRecorderOnLoad.hpp +34 -0
- package/nitrogen/generated/android/c++/JFunc_void_NativeRecorderError.hpp +78 -0
- package/nitrogen/generated/android/c++/JFunc_void_double_double.hpp +75 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__string.hpp +76 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__string_double_double_double.hpp +76 -0
- package/nitrogen/generated/android/c++/JHybridClarionRecorderSpec.cpp +207 -0
- package/nitrogen/generated/android/c++/JHybridClarionRecorderSpec.hpp +75 -0
- package/nitrogen/generated/android/c++/JNativeRecorderConfig.hpp +90 -0
- package/nitrogen/generated/android/c++/JNativeRecorderError.hpp +65 -0
- package/nitrogen/generated/android/c++/JNativeRecorderResult.hpp +77 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/clarion/recorder/ClarionRecorderOnLoad.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/clarion/recorder/Func_void_NativeRecorderError.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/clarion/recorder/Func_void_double_double.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/clarion/recorder/Func_void_std__string.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/clarion/recorder/Func_void_std__string_double_double_double.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/clarion/recorder/HybridClarionRecorderSpec.kt +125 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/clarion/recorder/NativeRecorderConfig.kt +91 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/clarion/recorder/NativeRecorderError.kt +61 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/clarion/recorder/NativeRecorderResult.kt +76 -0
- package/nitrogen/generated/ios/ClarionRecorder+autolinking.rb +62 -0
- package/nitrogen/generated/ios/ClarionRecorder-Swift-Cxx-Bridge.cpp +89 -0
- package/nitrogen/generated/ios/ClarionRecorder-Swift-Cxx-Bridge.hpp +297 -0
- package/nitrogen/generated/ios/ClarionRecorder-Swift-Cxx-Umbrella.hpp +56 -0
- package/nitrogen/generated/ios/ClarionRecorderAutolinking.mm +33 -0
- package/nitrogen/generated/ios/ClarionRecorderAutolinking.swift +26 -0
- package/nitrogen/generated/ios/c++/HybridClarionRecorderSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridClarionRecorderSpecSwift.hpp +188 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_NativeRecorderError.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_NativeRecorderResult.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_double_double.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string_double_double_double.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridClarionRecorderSpec.swift +67 -0
- package/nitrogen/generated/ios/swift/HybridClarionRecorderSpec_cxx.swift +354 -0
- package/nitrogen/generated/ios/swift/NativeRecorderConfig.swift +108 -0
- package/nitrogen/generated/ios/swift/NativeRecorderError.swift +39 -0
- package/nitrogen/generated/ios/swift/NativeRecorderResult.swift +54 -0
- package/nitrogen/generated/shared/c++/HybridClarionRecorderSpec.cpp +34 -0
- package/nitrogen/generated/shared/c++/HybridClarionRecorderSpec.hpp +84 -0
- package/nitrogen/generated/shared/c++/NativeRecorderConfig.hpp +116 -0
- package/nitrogen/generated/shared/c++/NativeRecorderError.hpp +91 -0
- package/nitrogen/generated/shared/c++/NativeRecorderResult.hpp +103 -0
- package/package.json +68 -8
- package/react-native.config.js +10 -0
- package/src/RecorderEngine.ts +298 -0
- package/src/index.ts +8 -0
- package/src/native.ts +5 -0
- package/src/specs/ClarionRecorder.nitro.ts +58 -0
- package/index.js +0 -1
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NativeRecorderConfig.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
#include <string>
|
|
34
|
+
#include <optional>
|
|
35
|
+
|
|
36
|
+
namespace margelo::nitro::clarion::recorder {
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* A struct which can be represented as a JavaScript object (NativeRecorderConfig).
|
|
40
|
+
*/
|
|
41
|
+
struct NativeRecorderConfig final {
|
|
42
|
+
public:
|
|
43
|
+
double sampleRate SWIFT_PRIVATE;
|
|
44
|
+
double channels SWIFT_PRIVATE;
|
|
45
|
+
double bitDepth SWIFT_PRIVATE;
|
|
46
|
+
std::optional<std::string> outputDirectory SWIFT_PRIVATE;
|
|
47
|
+
std::optional<std::string> filenamePrefix SWIFT_PRIVATE;
|
|
48
|
+
std::optional<double> rotateAfterMs SWIFT_PRIVATE;
|
|
49
|
+
bool emitAudioLevel SWIFT_PRIVATE;
|
|
50
|
+
double audioLevelIntervalMs SWIFT_PRIVATE;
|
|
51
|
+
double aacBitrate SWIFT_PRIVATE;
|
|
52
|
+
|
|
53
|
+
public:
|
|
54
|
+
NativeRecorderConfig() = default;
|
|
55
|
+
explicit NativeRecorderConfig(double sampleRate, double channels, double bitDepth, std::optional<std::string> outputDirectory, std::optional<std::string> filenamePrefix, std::optional<double> rotateAfterMs, bool emitAudioLevel, double audioLevelIntervalMs, double aacBitrate): sampleRate(sampleRate), channels(channels), bitDepth(bitDepth), outputDirectory(outputDirectory), filenamePrefix(filenamePrefix), rotateAfterMs(rotateAfterMs), emitAudioLevel(emitAudioLevel), audioLevelIntervalMs(audioLevelIntervalMs), aacBitrate(aacBitrate) {}
|
|
56
|
+
|
|
57
|
+
public:
|
|
58
|
+
friend bool operator==(const NativeRecorderConfig& lhs, const NativeRecorderConfig& rhs) = default;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
} // namespace margelo::nitro::clarion::recorder
|
|
62
|
+
|
|
63
|
+
namespace margelo::nitro {
|
|
64
|
+
|
|
65
|
+
// C++ NativeRecorderConfig <> JS NativeRecorderConfig (object)
|
|
66
|
+
template <>
|
|
67
|
+
struct JSIConverter<margelo::nitro::clarion::recorder::NativeRecorderConfig> final {
|
|
68
|
+
static inline margelo::nitro::clarion::recorder::NativeRecorderConfig fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
69
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
70
|
+
return margelo::nitro::clarion::recorder::NativeRecorderConfig(
|
|
71
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sampleRate"))),
|
|
72
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "channels"))),
|
|
73
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bitDepth"))),
|
|
74
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "outputDirectory"))),
|
|
75
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "filenamePrefix"))),
|
|
76
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rotateAfterMs"))),
|
|
77
|
+
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "emitAudioLevel"))),
|
|
78
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "audioLevelIntervalMs"))),
|
|
79
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "aacBitrate")))
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::clarion::recorder::NativeRecorderConfig& arg) {
|
|
83
|
+
jsi::Object obj(runtime);
|
|
84
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "sampleRate"), JSIConverter<double>::toJSI(runtime, arg.sampleRate));
|
|
85
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "channels"), JSIConverter<double>::toJSI(runtime, arg.channels));
|
|
86
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "bitDepth"), JSIConverter<double>::toJSI(runtime, arg.bitDepth));
|
|
87
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "outputDirectory"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.outputDirectory));
|
|
88
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "filenamePrefix"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.filenamePrefix));
|
|
89
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "rotateAfterMs"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.rotateAfterMs));
|
|
90
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "emitAudioLevel"), JSIConverter<bool>::toJSI(runtime, arg.emitAudioLevel));
|
|
91
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "audioLevelIntervalMs"), JSIConverter<double>::toJSI(runtime, arg.audioLevelIntervalMs));
|
|
92
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "aacBitrate"), JSIConverter<double>::toJSI(runtime, arg.aacBitrate));
|
|
93
|
+
return obj;
|
|
94
|
+
}
|
|
95
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
96
|
+
if (!value.isObject()) {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
jsi::Object obj = value.getObject(runtime);
|
|
100
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sampleRate")))) return false;
|
|
104
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "channels")))) return false;
|
|
105
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bitDepth")))) return false;
|
|
106
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "outputDirectory")))) return false;
|
|
107
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "filenamePrefix")))) return false;
|
|
108
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rotateAfterMs")))) return false;
|
|
109
|
+
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "emitAudioLevel")))) return false;
|
|
110
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "audioLevelIntervalMs")))) return false;
|
|
111
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "aacBitrate")))) return false;
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NativeRecorderError.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
#include <string>
|
|
34
|
+
|
|
35
|
+
namespace margelo::nitro::clarion::recorder {
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A struct which can be represented as a JavaScript object (NativeRecorderError).
|
|
39
|
+
*/
|
|
40
|
+
struct NativeRecorderError final {
|
|
41
|
+
public:
|
|
42
|
+
std::string code SWIFT_PRIVATE;
|
|
43
|
+
std::string message SWIFT_PRIVATE;
|
|
44
|
+
bool recoverable SWIFT_PRIVATE;
|
|
45
|
+
|
|
46
|
+
public:
|
|
47
|
+
NativeRecorderError() = default;
|
|
48
|
+
explicit NativeRecorderError(std::string code, std::string message, bool recoverable): code(code), message(message), recoverable(recoverable) {}
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
friend bool operator==(const NativeRecorderError& lhs, const NativeRecorderError& rhs) = default;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
} // namespace margelo::nitro::clarion::recorder
|
|
55
|
+
|
|
56
|
+
namespace margelo::nitro {
|
|
57
|
+
|
|
58
|
+
// C++ NativeRecorderError <> JS NativeRecorderError (object)
|
|
59
|
+
template <>
|
|
60
|
+
struct JSIConverter<margelo::nitro::clarion::recorder::NativeRecorderError> final {
|
|
61
|
+
static inline margelo::nitro::clarion::recorder::NativeRecorderError fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
62
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
63
|
+
return margelo::nitro::clarion::recorder::NativeRecorderError(
|
|
64
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "code"))),
|
|
65
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "message"))),
|
|
66
|
+
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "recoverable")))
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::clarion::recorder::NativeRecorderError& arg) {
|
|
70
|
+
jsi::Object obj(runtime);
|
|
71
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "code"), JSIConverter<std::string>::toJSI(runtime, arg.code));
|
|
72
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "message"), JSIConverter<std::string>::toJSI(runtime, arg.message));
|
|
73
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "recoverable"), JSIConverter<bool>::toJSI(runtime, arg.recoverable));
|
|
74
|
+
return obj;
|
|
75
|
+
}
|
|
76
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
77
|
+
if (!value.isObject()) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
jsi::Object obj = value.getObject(runtime);
|
|
81
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "code")))) return false;
|
|
85
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "message")))) return false;
|
|
86
|
+
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "recoverable")))) return false;
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NativeRecorderResult.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
#include <string>
|
|
34
|
+
|
|
35
|
+
namespace margelo::nitro::clarion::recorder {
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A struct which can be represented as a JavaScript object (NativeRecorderResult).
|
|
39
|
+
*/
|
|
40
|
+
struct NativeRecorderResult final {
|
|
41
|
+
public:
|
|
42
|
+
std::string uri SWIFT_PRIVATE;
|
|
43
|
+
double durationMs SWIFT_PRIVATE;
|
|
44
|
+
double sizeBytes SWIFT_PRIVATE;
|
|
45
|
+
double sampleRate SWIFT_PRIVATE;
|
|
46
|
+
double channels SWIFT_PRIVATE;
|
|
47
|
+
double bitDepth SWIFT_PRIVATE;
|
|
48
|
+
|
|
49
|
+
public:
|
|
50
|
+
NativeRecorderResult() = default;
|
|
51
|
+
explicit NativeRecorderResult(std::string uri, double durationMs, double sizeBytes, double sampleRate, double channels, double bitDepth): uri(uri), durationMs(durationMs), sizeBytes(sizeBytes), sampleRate(sampleRate), channels(channels), bitDepth(bitDepth) {}
|
|
52
|
+
|
|
53
|
+
public:
|
|
54
|
+
friend bool operator==(const NativeRecorderResult& lhs, const NativeRecorderResult& rhs) = default;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
} // namespace margelo::nitro::clarion::recorder
|
|
58
|
+
|
|
59
|
+
namespace margelo::nitro {
|
|
60
|
+
|
|
61
|
+
// C++ NativeRecorderResult <> JS NativeRecorderResult (object)
|
|
62
|
+
template <>
|
|
63
|
+
struct JSIConverter<margelo::nitro::clarion::recorder::NativeRecorderResult> final {
|
|
64
|
+
static inline margelo::nitro::clarion::recorder::NativeRecorderResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
65
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
66
|
+
return margelo::nitro::clarion::recorder::NativeRecorderResult(
|
|
67
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "uri"))),
|
|
68
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "durationMs"))),
|
|
69
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sizeBytes"))),
|
|
70
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sampleRate"))),
|
|
71
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "channels"))),
|
|
72
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bitDepth")))
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::clarion::recorder::NativeRecorderResult& arg) {
|
|
76
|
+
jsi::Object obj(runtime);
|
|
77
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "uri"), JSIConverter<std::string>::toJSI(runtime, arg.uri));
|
|
78
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "durationMs"), JSIConverter<double>::toJSI(runtime, arg.durationMs));
|
|
79
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "sizeBytes"), JSIConverter<double>::toJSI(runtime, arg.sizeBytes));
|
|
80
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "sampleRate"), JSIConverter<double>::toJSI(runtime, arg.sampleRate));
|
|
81
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "channels"), JSIConverter<double>::toJSI(runtime, arg.channels));
|
|
82
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "bitDepth"), JSIConverter<double>::toJSI(runtime, arg.bitDepth));
|
|
83
|
+
return obj;
|
|
84
|
+
}
|
|
85
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
86
|
+
if (!value.isObject()) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
jsi::Object obj = value.getObject(runtime);
|
|
90
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "uri")))) return false;
|
|
94
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "durationMs")))) return false;
|
|
95
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sizeBytes")))) return false;
|
|
96
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sampleRate")))) return false;
|
|
97
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "channels")))) return false;
|
|
98
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bitDepth")))) return false;
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
} // namespace margelo::nitro
|
package/package.json
CHANGED
|
@@ -1,11 +1,71 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clarionhq/recorder",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Clarion recorder —
|
|
5
|
-
"main": "index.js",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Clarion recorder — PCM capture to m4a for React Native (offline-first)",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"types": "lib/index.d.ts",
|
|
7
|
+
"react-native": "src/index.ts",
|
|
8
|
+
"source": "src/index.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"lib",
|
|
11
|
+
"src",
|
|
12
|
+
"android/src",
|
|
13
|
+
"android/build.gradle",
|
|
14
|
+
"android/gradle.properties",
|
|
15
|
+
"android/CMakeLists.txt",
|
|
16
|
+
"android/proguard-rules.pro",
|
|
17
|
+
"ios",
|
|
18
|
+
"nitrogen",
|
|
19
|
+
"nitro.json",
|
|
20
|
+
"react-native.config.js",
|
|
21
|
+
"clarionhq-recorder.podspec",
|
|
22
|
+
"README.md",
|
|
23
|
+
"LICENSE",
|
|
24
|
+
"!**/__tests__",
|
|
25
|
+
"!**/__fixtures__",
|
|
26
|
+
"!**/.*"
|
|
27
|
+
],
|
|
28
|
+
"keywords": [
|
|
29
|
+
"react-native",
|
|
30
|
+
"audio",
|
|
31
|
+
"recorder",
|
|
32
|
+
"pcm",
|
|
33
|
+
"m4a",
|
|
34
|
+
"aac",
|
|
35
|
+
"audiorecord",
|
|
36
|
+
"avaudioengine",
|
|
37
|
+
"nitro-modules",
|
|
38
|
+
"turbomodule",
|
|
39
|
+
"fabric",
|
|
40
|
+
"new-architecture"
|
|
41
|
+
],
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@clarionhq/core": "0.1.0"
|
|
44
|
+
},
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"react": ">=18.3.1",
|
|
47
|
+
"react-native": ">=0.77.0",
|
|
48
|
+
"react-native-nitro-modules": ">=0.35.0"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"nitrogen": "^0.35.6",
|
|
52
|
+
"react": "18.3.1",
|
|
53
|
+
"react-native": "0.77.3",
|
|
54
|
+
"react-native-nitro-modules": "^0.35.6"
|
|
55
|
+
},
|
|
6
56
|
"license": "MIT",
|
|
7
|
-
"publishConfig": {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"
|
|
11
|
-
|
|
57
|
+
"publishConfig": {
|
|
58
|
+
"access": "public"
|
|
59
|
+
},
|
|
60
|
+
"repository": {
|
|
61
|
+
"type": "git",
|
|
62
|
+
"url": "https://github.com/Th4nderG0d/clarion",
|
|
63
|
+
"directory": "packages/recorder"
|
|
64
|
+
},
|
|
65
|
+
"scripts": {
|
|
66
|
+
"build": "tsc -p tsconfig.json",
|
|
67
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
68
|
+
"nitro:codegen": "nitrogen",
|
|
69
|
+
"clean": "rm -rf lib nitrogen"
|
|
70
|
+
}
|
|
71
|
+
}
|