@react-native-ohos/audio-toolkit 2.0.4-rc.1 → 2.0.4-rc.3

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.
Files changed (52) hide show
  1. package/CHANGELOG.md +2 -136
  2. package/LICENSE +22 -22
  3. package/{harmony/audio_toolkit/OAT.xml → OAT.xml} +47 -37
  4. package/README.md +11 -17
  5. package/ReactNativeAudioToolkit.podspec +18 -18
  6. package/harmony/audio_toolkit/build-profile.json5 +7 -7
  7. package/harmony/audio_toolkit/hvigorfile.ts +1 -1
  8. package/harmony/audio_toolkit/index.ets +26 -25
  9. package/harmony/audio_toolkit/oh-package.json5 +12 -12
  10. package/harmony/audio_toolkit/src/main/cpp/AudioToolkitPackage.h +15 -0
  11. package/harmony/audio_toolkit/src/main/cpp/CMakeLists.txt +10 -0
  12. package/harmony/audio_toolkit/src/main/cpp/generated/RNOH/generated/BaseReactNativeAudioToolkitPackage.h +69 -0
  13. package/harmony/audio_toolkit/src/main/cpp/generated/RNOH/generated/turbo_modules/RCTAudioPlayer.cpp +23 -0
  14. package/harmony/audio_toolkit/src/main/cpp/generated/RNOH/generated/turbo_modules/RCTAudioPlayer.h +16 -0
  15. package/harmony/audio_toolkit/src/main/cpp/generated/RNOH/generated/turbo_modules/RCTAudioRecorder.cpp +20 -0
  16. package/harmony/audio_toolkit/src/main/cpp/generated/RNOH/generated/turbo_modules/RCTAudioRecorder.h +16 -0
  17. package/harmony/audio_toolkit/src/main/cpp/generated/react/renderer/components/react_native_audio_toolkit/ComponentDescriptors.h +22 -0
  18. package/harmony/audio_toolkit/src/main/cpp/generated/react/renderer/components/react_native_audio_toolkit/EventEmitters.cpp +18 -0
  19. package/harmony/audio_toolkit/src/main/cpp/generated/react/renderer/components/react_native_audio_toolkit/EventEmitters.h +19 -0
  20. package/harmony/audio_toolkit/src/main/cpp/generated/react/renderer/components/react_native_audio_toolkit/Props.cpp +21 -0
  21. package/harmony/audio_toolkit/src/main/cpp/generated/react/renderer/components/react_native_audio_toolkit/Props.h +20 -0
  22. package/harmony/audio_toolkit/src/main/cpp/generated/react/renderer/components/react_native_audio_toolkit/ShadowNodes.cpp +19 -0
  23. package/harmony/audio_toolkit/src/main/cpp/generated/react/renderer/components/react_native_audio_toolkit/ShadowNodes.h +25 -0
  24. package/harmony/audio_toolkit/src/main/cpp/generated/react/renderer/components/react_native_audio_toolkit/States.cpp +18 -0
  25. package/harmony/audio_toolkit/src/main/cpp/generated/react/renderer/components/react_native_audio_toolkit/States.h +23 -0
  26. package/harmony/audio_toolkit/src/main/ets/{AudioToolkitPackage.ts → AudioToolkitPackage.ets} +51 -50
  27. package/harmony/audio_toolkit/src/main/ets/Logger.ts +63 -63
  28. package/harmony/audio_toolkit/src/main/ets/RNCAudioPlayerTurboModule.ts +432 -432
  29. package/harmony/audio_toolkit/src/main/ets/RNCAudioRecorderTurboModule.ts +260 -260
  30. package/harmony/audio_toolkit/src/main/ets/generated/components/ts.ts +5 -0
  31. package/harmony/audio_toolkit/src/main/ets/generated/index.ets +5 -0
  32. package/harmony/audio_toolkit/src/main/ets/generated/ts.ts +6 -0
  33. package/harmony/audio_toolkit/src/main/ets/generated/turboModules/RCTAudioPlayer.ts +40 -0
  34. package/harmony/audio_toolkit/src/main/ets/generated/turboModules/RCTAudioRecorder.ts +24 -0
  35. package/harmony/audio_toolkit/src/main/ets/generated/turboModules/ts.ts +6 -0
  36. package/harmony/audio_toolkit/src/main/module.json5 +6 -6
  37. package/harmony/audio_toolkit/src/main/resources/base/element/string.json +7 -7
  38. package/harmony/audio_toolkit/src/main/resources/en_US/element/string.json +7 -7
  39. package/harmony/audio_toolkit/src/main/resources/zh_CN/element/string.json +7 -7
  40. package/harmony/audio_toolkit/{ts.ts → ts.ets} +25 -25
  41. package/harmony/audio_toolkit.har +0 -0
  42. package/package.json +48 -46
  43. package/src/Player.js +329 -329
  44. package/src/PlayerModule.ts +51 -51
  45. package/src/Recorder.js +183 -183
  46. package/src/RecorderModule.ts +83 -83
  47. package/src/index.ts +5 -5
  48. package/harmony/audio_toolkit/BuildProfile.ets +0 -17
  49. package/harmony/audio_toolkit/LICENSE +0 -21
  50. package/harmony/audio_toolkit/NOTICE +0 -33
  51. package/harmony/audio_toolkit/README.OpenSource +0 -11
  52. package/harmony/audio_toolkit/README.md +0 -230
package/CHANGELOG.md CHANGED
@@ -1,136 +1,2 @@
1
- # Changelog
2
- All notable changes to this project will be documented in this file.
3
-
4
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
5
-
6
- ## Unreleased
7
- ### Added
8
- - Add inline base64 audio URL support
9
- - Add ability to generate metering events while recording, which measure sound input levels
10
-
11
- ### Fixed
12
- - Android: Fixed a compatibility issue on Android where on some Android models (e.g. HUAWEI) a -38 error is generated
13
- - iOS: Fixed duration not being provided until getCurrentTime is called
14
-
15
- ## [2.0.3] - 2020-03-23
16
- ### Added
17
- - Add Player option mixWithOthers
18
- - iOS: Add ability to override audio session category
19
-
20
- ### Changed
21
- - Android: Remove unneeded references to Android support library, improving Android X support
22
-
23
- ### Fixed
24
- - iOS: Made linking to RCTBridgeModule.h more robust
25
- - iOS: Fixed podspec not using right Git tag string
26
-
27
- ## [2.0.2] - 2019-07-09
28
- ### Added
29
- - Cocoapods support
30
-
31
- ### Changed
32
- - Add more specific error strings to TypeScript error types
33
-
34
- ### Fixed
35
- - Android: Fix Gradle warning related to defining the targetSdk within the AndroidManifest.xml
36
-
37
- ## [2.0.1] - 2019-06-26
38
- ### Fixed
39
- - Fixed iOS linking errors caused by change of folder structure
40
-
41
- ## [2.0.0] - 2019-06-26
42
- ### BREAKING CHANGES
43
- - Changed npm package name from `react-native-audio-toolkit` to `@react-native-community/audio-toolkit` and changed Android namespace from `com.futurice.rctaudiotoolkit` to `com.reactnativecommunity.rctaudiotoolkit`. These changes require users to reinstall and re-link the library to update to this version. This can be done manually or automatically during the update process via:
44
- ```
45
- react-native unlink react-native-audio-toolkit
46
- npm uninstall --save react-native-audio-toolkit
47
- npm install --save @react-native-community/audio-toolkit
48
- react-native link @react-native-community/audio-toolkit
49
- ```
50
- - Android: Remove permissions from library AndroidManifest and instead require users to add them. See [SETUP.md](https://github.com/react-native-community/react-native-audio-toolkit/blob/master/docs/SETUP.md) and PR [#148](https://github.com/react-native-community/react-native-audio-toolkit/pull/148) for more details
51
-
52
- ### Added
53
- - Add Typescript typings
54
- - Add ability to set playback speed for audio player
55
- - Add ability to pause a Recorder
56
- - Android: Add ability to record to AAC
57
- - iOS: Added possibility to record from Bluetooth microphone
58
-
59
- ### Changed
60
- - Specify exactly which files to include in npm package
61
- - Only import specific items from lodash to keep build size down
62
- - Android: `build.gradle` will use SDK version settings of the root project, if available
63
- - iOS: Buffer up to 10 seconds of audio before beginning playback
64
-
65
- ### Fixed
66
- - Fixed some incorrect examples in the documentation
67
- - Android: Guard against possible exceptions while parsing stack trace
68
- - Android: Guard against exceptions that can appear in onHostPause
69
- - Android: Fix build error related to defining `android:minSdkVersion` in the library's AndroidManifest
70
- - Android: Fix crash on devices running API level 22 or earlier
71
- - iOS: Fix `Player.pause()` not setting `PAUSED` state
72
-
73
- ## [1.0.6] - 2017-11-01
74
- ### Changed
75
- - Android: Changed prepare to prepareAsync
76
-
77
- ### Fixed
78
- - Fix compatibility with React Native 0.47
79
- - Fix compatibility with React Native 0.48
80
- - Fix compatibility with React Native 0.49
81
- - Android: Fix updating playerContinueInBackground
82
- - Android: Fix a bug when finding audio file
83
- - Android: Fix compatibility with API level 16 by removing usage of `java.util.Objects`
84
-
85
- ## [1.0.5] - 2016-09-22
86
- ### Changed
87
- - Android: By default pause playback if app is sent to background
88
-
89
- ## [1.0.4] - 2016-08-26
90
- ### Fixed
91
- - iOS: Fix audio events
92
-
93
- ## [1.0.3] - 2016-08-17
94
- ### Added
95
- - Add Player state diagram to documentation
96
- - Add recording example to README.md
97
- - Record `prepare()` returns filesystem path of file being recorded to
98
-
99
- ### Fixed
100
- - Missing `this` in setup example
101
-
102
- ## [1.0.2] - 2016-06-25
103
- ### Added
104
- - Add description to package.json
105
-
106
- ## [1.0.1] - 2016-06-25
107
- ### Added
108
- - Add repository to package.json
109
- - Add error handling to Example App
110
- - iOS: Send current position at pause
111
-
112
- ### Changed
113
- - Move documentation from README.md to separate files within docs directory
114
- - Improve documentation
115
- - Restructure Player and Recorder into own source files
116
-
117
- ### Fixed
118
- - Android: Fix seeking, hide debug prints
119
- - Android: Fix stop bug
120
- - iOS: Fixed parsing of quality strings
121
-
122
- ## 1.0.0 - 2016-06-25
123
-
124
- Initial release.
125
-
126
-
127
- [2.0.3]: https://github.com/react-native-community/react-native-audio-toolkit/compare/f51bac3ee751e72f916abb657c2f594e870a36ac...HEAD
128
- [2.0.2]: https://github.com/react-native-community/react-native-audio-toolkit/compare/caa399431afdcb70a2aa73fe436cdf00e3ea92d0...f51bac3ee751e72f916abb657c2f594e870a36ac
129
- [2.0.1]: https://github.com/react-native-community/react-native-audio-toolkit/commit/caa399431afdcb70a2aa73fe436cdf00e3ea92d0
130
- [2.0.0]: https://github.com/react-native-community/react-native-audio-toolkit/compare/dc2f04a35f388016aa294bcc80e7f553d1988037...ed89597b2e319c9073f2156c81c48c7ff8a7993f
131
- [1.0.6]: https://github.com/react-native-community/react-native-audio-toolkit/compare/4746870166fe4beb9fbf075d45fab952de4558d6...dc2f04a35f388016aa294bcc80e7f553d1988037
132
- [1.0.5]: https://github.com/react-native-community/react-native-audio-toolkit/compare/6a2641ebc6b6177fa29ac81b694ea2dd64d5a2cd...4746870166fe4beb9fbf075d45fab952de4558d6
133
- [1.0.4]: https://github.com/react-native-community/react-native-audio-toolkit/compare/eba2326941e9b2f4405e832ce5af0a85bf6817ef...6a2641ebc6b6177fa29ac81b694ea2dd64d5a2cd
134
- [1.0.3]: https://github.com/react-native-community/react-native-audio-toolkit/compare/24dc361c950c2f4a919d557c4b2c7abecb28c6e8...eba2326941e9b2f4405e832ce5af0a85bf6817ef
135
- [1.0.2]: https://github.com/react-native-community/react-native-audio-toolkit/compare/3384ceff8bdf34904b09abb34602f8f4120bcb9e...24dc361c950c2f4a919d557c4b2c7abecb28c6e8
136
- [1.0.1]: https://github.com/react-native-community/react-native-audio-toolkit/compare/05523e1181ee0a8d41d0e4db9f192d2d48be2bb4...3384ceff8bdf34904b09abb34602f8f4120bcb9e
1
+ # Changelog
2
+ All notable changes to this project will be documented in this file.
package/LICENSE CHANGED
@@ -1,22 +1,22 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2016-2019 Futurice
4
- Copyright (c) 2019+ React Native Community.
5
-
6
- Permission is hereby granted, free of charge, to any person obtaining a copy
7
- of this software and associated documentation files (the "Software"), to deal
8
- in the Software without restriction, including without limitation the rights
9
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- copies of the Software, and to permit persons to whom the Software is
11
- furnished to do so, subject to the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be included in all
14
- copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- SOFTWARE.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016-2019 Futurice
4
+ Copyright (c) 2019+ React Native Community.
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
@@ -1,38 +1,48 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <configuration>
3
- <oatconfig>
4
- <licensefile>LICENSE</licensefile>
5
- <filefilterlist>
6
- <filefilter name="copyrightPolicyFilter" desc="Filters for compatibility,license header policies">
7
- <filteritem type="filename" name="hvigorfile.ts" desc="hvigor构建脚本,DevEco Studio自动生成,不需要添加版权头"/>
8
- <filteritem type="filename" name="*.json5" desc="hvigor工程配置文件,DevEco Studio自动生成,不需要添加版权头"/>
9
- <filteritem type="filename" name="*.proto" desc="资源文件,不需要添加版权头"/>
10
- <filteritem type="filename" name="*.json" desc="资源文件,不需要添加版权头"/>
11
- <filteritem type="filepath" name="hvigorw" desc="工程模板,不修改版权头,以防有修改版权风险"/>
12
- <filteritem type="filepath" name="hvigorw.bat" desc="工程模板,不修改版权头,以防有修改版权风险"/>
13
- <filteritem type="filepath" name="hvigor/hvigor-wrapper.js" desc="工程模板,不修改版权头,以防有修改版权风险"/>
14
- <filteritem type="filename" name="LICENSE" desc="工程文件,不修改版权头"/>
15
- </filefilter>
16
- <filefilter name="defaultPolicyFilter" desc="Filters for compatibility,license header policies">
17
- <filteritem type="filename" name="hvigorfile.ts" desc="hvigor构建脚本,DevEco Studio自动生成,不需要添加许可证头"/>
18
- <filteritem type="filename" name="*.json5" desc="hvigor工程配置文件,DevEco Studio自动生成,不需要添加许可证头"/>
19
- <filteritem type="filename" name="LICENSE" desc="原三方库证书文件无需更改,因此添加过滤"/>
20
- <filteritem type="filename" name="*.proto" desc="资源文件,不需要添加许可证头"/>
21
- <filteritem type="filename" name="*.json" desc="资源文件,不需要添加许可证头"/>
22
- <filteritem type="filepath" name="hvigorw" desc="工程模板,不修改版权头,以防有修改版权风险"/>
23
- <filteritem type="filepath" name="hvigorw.bat" desc="工程模板,不修改版权头,以防有修改版权风险"/>
24
- <filteritem type="filepath" name="hvigor/hvigor-wrapper.js" desc="工程模板,不修改版权头,以防有修改版权风险"/>
25
- </filefilter>
26
- <filefilter name="binaryFileTypePolicyFilter" desc="Filters for resources files policies">
27
- <filteritem type="filename" name="icon.png" desc="应用图标"/>
28
- <filteritem type="filename" name="app_icon.png" desc="应用图标"/>
29
- <filteritem type="filename" name="warn.png" desc="页面展示图标"/>
30
- </filefilter>
31
- </filefilterlist>
32
- <policylist>
33
- <policy name="projectPolicy" desc="">
34
- <policyitem type="license" name="MIT" path="*.*" desc="license under the MIT"/>
35
- </policy>
36
- </policylist>
37
- </oatconfig>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <configuration>
3
+ <oatconfig>
4
+ <licensefile>LICENSE</licensefile>
5
+ <filefilterlist>
6
+ <filefilter name="copyrightPolicyFilter" desc="Filters for compatibility,license header policies">
7
+ <filteritem type="filename" name="hvigorfile.ts" desc="hvigor构建脚本,DevEco Studio自动生成,不需要添加版权头"/>
8
+ <filteritem type="filename" name="*.json5" desc="hvigor工程配置文件,DevEco Studio自动生成,不需要添加版权头"/>
9
+ <filteritem type="filename" name="*.proto" desc="资源文件,不需要添加版权头"/>
10
+ <filteritem type="filename" name="*.json" desc="资源文件,不需要添加版权头"/>
11
+ <filteritem type="filepath" name="hvigorw" desc="工程模板,不修改版权头,以防有修改版权风险"/>
12
+ <filteritem type="filepath" name="hvigorw.bat" desc="工程模板,不修改版权头,以防有修改版权风险"/>
13
+ <filteritem type="filepath" name="hvigor/hvigor-wrapper.js" desc="工程模板,不修改版权头,以防有修改版权风险"/>
14
+ <filteritem type="filename" name="LICENSE" desc="工程文件,不修改版权头"/>
15
+ <filteritem type="filepath" name="src/.*" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
16
+ </filefilter>
17
+ <filefilter name="defaultPolicyFilter" desc="Filters for compatibility,license header policies">
18
+ <filteritem type="filename" name="hvigorfile.ts" desc="hvigor构建脚本,DevEco Studio自动生成,不需要添加许可证头"/>
19
+ <filteritem type="filename" name="*.json5" desc="hvigor工程配置文件,DevEco Studio自动生成,不需要添加许可证头"/>
20
+ <filteritem type="filename" name="LICENSE" desc="原三方库证书文件无需更改,因此添加过滤"/>
21
+ <filteritem type="filename" name="*.proto" desc="资源文件,不需要添加许可证头"/>
22
+ <filteritem type="filename" name="*.json" desc="资源文件,不需要添加许可证头"/>
23
+ <filteritem type="filepath" name="hvigorw" desc="工程模板,不修改版权头,以防有修改版权风险"/>
24
+ <filteritem type="filepath" name="hvigorw.bat" desc="工程模板,不修改版权头,以防有修改版权风险"/>
25
+ <filteritem type="filepath" name="hvigor/hvigor-wrapper.js" desc="工程模板,不修改版权头,以防有修改版权风险"/>
26
+ <filteritem type="filepath" name="src/.*" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
27
+ </filefilter>
28
+ <filefilter name="binaryFileTypePolicyFilter" desc="Filters for resources files policies">
29
+ <filteritem type="filename" name="icon.png" desc="应用图标"/>
30
+ <filteritem type="filename" name="app_icon.png" desc="应用图标"/>
31
+ <filteritem type="filename" name="warn.png" desc="页面展示图标"/>
32
+ <filteritem type="filepath" name="harmony/audio_toolkit.har" desc="项目打包文件"/>
33
+ </filefilter>
34
+ </filefilterlist>
35
+ <policylist>
36
+ <policy name="projectPolicy" desc="">
37
+ <policyitem type="license" name="MIT" path="*.*" desc="license under the MIT"/>
38
+ </policy>
39
+ <policy name="projectPolicy" desc="">
40
+ <policyitem type="compatibility" name="GPL-2.0+" path=".*" desc="Process that runs independently, invoked by the X process."/>
41
+ <policyitem type="compatibility" name="Apache-2.0" path=".*" desc="不影响兼容性"/>
42
+ <policyitem type="compatibility" name="BSDStyleLicense" path=".*" desc="不影响兼容性" />
43
+ <policyitem type="compatibility" name="MIT" path=".*" desc="不影响兼容性" />
44
+ <policyitem type="compatibility" name="GPLStyleLicense" path=".*" desc="不影响兼容性" />
45
+ </policy>
46
+ </policylist>
47
+ </oatconfig>
38
48
  </configuration>
package/README.md CHANGED
@@ -1,17 +1,11 @@
1
- # react-native-audio-toolkit
2
-
3
- 本项目基于 [react-native-audio-toolkit](https://github.com/react-native-audio-toolkit/react-native-audio-toolkit)
4
-
5
- ## 文档地址 / Documentation URL
6
-
7
- [中文 / Chinese](https://gitee.com/react-native-oh-library/usage-docs/blob/master/zh-cn/react-native-audio-toolkit.md)
8
-
9
- ## Codegen
10
-
11
- 该库已接入 codegen,具体请查阅文档。
12
-
13
- The library has been integrated with codegen. Please refer to the documentation for details.
14
-
15
- ## 请悉知 / Acknowledgements
16
-
17
- 本项目基于 [The MIT License (MIT)](hhttps://github.com/react-native-audio-toolkit/react-native-audio-toolkit/blob/master/LICENSE) ,请自由地享受和参与开源。
1
+ # @react-native-ohos/audio-toolkit
2
+
3
+ This project is based on [react-native-audio-toolkit@2.0.3](https://github.com/react-native-audio-toolkit/react-native-audio-toolkit/tree/v2.0.3)
4
+ ## Documentation
5
+
6
+ [中文](https://gitee.com/react-native-oh-library/usage-docs/blob/master/zh-cn/react-native-audio-toolkit.md)
7
+ [English](https://gitee.com/react-native-oh-library/usage-docs/blob/master/en/react-native-audio-toolkit.md)
8
+
9
+ ## License
10
+
11
+ This project is based on [The MIT License (MIT)](https://github.com/react-native-audio-toolkit/react-native-audio-toolkit/blob/master/LICENSE)
@@ -1,18 +1,18 @@
1
- require "json"
2
-
3
- # NPM package specification
4
- package = JSON.parse(File.read(File.join(File.dirname(__FILE__), "package.json")))
5
-
6
- Pod::Spec.new do |s|
7
- s.name = "ReactNativeAudioToolkit"
8
- s.version = package["version"]
9
- s.summary = package["description"]
10
- s.homepage = package["homepage"]
11
- s.license = "MIT"
12
- s.author = { "Rasmus Eskola" => "fruitiex@gmail.com" }
13
- s.platforms = { :ios => "9.0", :tvos => "9.0" }
14
- s.source = { :git => package["repository"]["url"], :tag => "v#{s.version}" }
15
- s.source_files = "ios/**/*.{h,m}"
16
-
17
- s.dependency "React"
18
- end
1
+ require "json"
2
+
3
+ # NPM package specification
4
+ package = JSON.parse(File.read(File.join(File.dirname(__FILE__), "package.json")))
5
+
6
+ Pod::Spec.new do |s|
7
+ s.name = "ReactNativeAudioToolkit"
8
+ s.version = package["version"]
9
+ s.summary = package["description"]
10
+ s.homepage = package["homepage"]
11
+ s.license = "MIT"
12
+ s.author = { "Rasmus Eskola" => "fruitiex@gmail.com" }
13
+ s.platforms = { :ios => "9.0", :tvos => "9.0" }
14
+ s.source = { :git => package["repository"]["url"], :tag => "v#{s.version}" }
15
+ s.source_files = "ios/**/*.{h,m}"
16
+
17
+ s.dependency "React"
18
+ end
@@ -1,8 +1,8 @@
1
- {
2
- "apiType": "stageMode",
3
- "targets": [
4
- {
5
- "name": "default",
6
- }
7
- ]
1
+ {
2
+ "apiType": "stageMode",
3
+ "targets": [
4
+ {
5
+ "name": "default",
6
+ }
7
+ ]
8
8
  }
@@ -1 +1 @@
1
- export { harTasks } from '@ohos/hvigor-ohos-plugin';
1
+ export { harTasks } from '@ohos/hvigor-ohos-plugin';
@@ -1,25 +1,26 @@
1
- /**
2
- * MIT License
3
- *
4
- * Copyright (C) 2023 Huawei Device Co., Ltd.
5
- *
6
- * Permission is hereby granted, free of charge, to any person obtaining a copy
7
- * of this software and associated documentation files (the "Software"), to deal
8
- * in the Software without restriction, including without limitation the rights
9
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- * copies of the Software, and to permit persons to whom the Software is
11
- * furnished to do so, subject to the following conditions:
12
- *
13
- * The above copyright notice and this permission notice shall be included in all
14
- * copies or substantial portions of the Software.
15
- *
16
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- * SOFTWARE.
23
- */
24
-
25
- export * from './ts'
1
+ /**
2
+ * MIT License
3
+ *
4
+ * Copyright (C) 2023 Huawei Device Co., Ltd.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+ import { AudioModulesPackage as AudioToolkitPackage } from "./src/main/ets/AudioToolkitPackage";
25
+ export * from './ts'
26
+ export default AudioToolkitPackage;
@@ -1,12 +1,12 @@
1
- {
2
- "license": "ISC",
3
- "types": "",
4
- "devDependencies": {},
5
- "name": "@react-native-ohos/audio-toolkit",
6
- "version": "2.0.4-rc.1",
7
- "description": "",
8
- "main": "index.ets",
9
- "dependencies": {
10
- "@rnoh/react-native-openharmony": "file:../libs/react_native_openharmony-5.0.0.490.har"
11
- }
12
- }
1
+ {
2
+ "license": "ISC",
3
+ "types": "",
4
+ "devDependencies": {},
5
+ "name": "@react-native-ohos/audio-toolkit",
6
+ "version": "2.0.4-rc.3",
7
+ "description": "",
8
+ "main": "index.ets",
9
+ "dependencies": {
10
+ "@rnoh/react-native-openharmony": "file:../libs/react_native_openharmony-5.0.0.490.har"
11
+ }
12
+ }
@@ -0,0 +1,15 @@
1
+ /*
2
+ * Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
3
+ * Use of this source code is governed by a MIT license that can be
4
+ * found in the LICENSE file
5
+ */
6
+
7
+ #include "generated/RNOH/generated/BaseReactNativeAudioToolkitPackage.h"
8
+ #pragma once
9
+
10
+ namespace rnoh {
11
+ class AudioToolkitPackage : public BaseReactNativeAudioToolkitPackage {
12
+ using Super = BaseReactNativeAudioToolkitPackage;
13
+ using Super::Super;
14
+ };
15
+ } // namespace rnoh
@@ -0,0 +1,10 @@
1
+ cmake_minimum_required(VERSION 3.13)
2
+ set(CMAKE_VERBOSE_MAKEFILE on)
3
+
4
+ set(rnoh_audio_toolkit_generated_dir "${CMAKE_CURRENT_SOURCE_DIR}/generated")
5
+
6
+ file(GLOB_RECURSE rnoh_audio_toolkit_generated_SRC "${rnoh_audio_toolkit_generated_dir}/**/*.cpp")
7
+ file(GLOB rnoh_audio_toolkit_SRC CONFIGURE_DEPENDS *.cpp)
8
+ add_library(rnoh_audio_toolkit SHARED ${rnoh_audio_toolkit_SRC} ${rnoh_audio_toolkit_generated_SRC})
9
+ target_include_directories(rnoh_audio_toolkit PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${rnoh_audio_toolkit_generated_dir})
10
+ target_link_libraries(rnoh_audio_toolkit PUBLIC rnoh)
@@ -0,0 +1,69 @@
1
+ /**
2
+ * This code was generated by "react-native codegen-lib-harmony"
3
+ */
4
+
5
+ #pragma once
6
+
7
+ #include "RNOH/Package.h"
8
+ #include "RNOH/ArkTSTurboModule.h"
9
+ #include "RNOH/generated/turbo_modules/RCTAudioPlayer.h"
10
+ #include "RNOH/generated/turbo_modules/RCTAudioRecorder.h"
11
+
12
+ namespace rnoh {
13
+
14
+ class BaseReactNativeAudioToolkitPackageTurboModuleFactoryDelegate : public TurboModuleFactoryDelegate {
15
+ public:
16
+ SharedTurboModule createTurboModule(Context ctx, const std::string &name) const override {
17
+ if (name == "RCTAudioPlayer") {
18
+ return std::make_shared<RCTAudioPlayer>(ctx, name);
19
+ }
20
+ if (name == "RCTAudioRecorder") {
21
+ return std::make_shared<RCTAudioRecorder>(ctx, name);
22
+ }
23
+ return nullptr;
24
+ };
25
+ };
26
+
27
+ class BaseReactNativeAudioToolkitPackageEventEmitRequestHandler : public EventEmitRequestHandler {
28
+ public:
29
+ void handleEvent(Context const &ctx) override {
30
+ auto eventEmitter = ctx.shadowViewRegistry->getEventEmitter<facebook::react::EventEmitter>(ctx.tag);
31
+ if (eventEmitter == nullptr) {
32
+ return;
33
+ }
34
+
35
+ std::vector<std::string> supportedEventNames = {
36
+ };
37
+ if (std::find(supportedEventNames.begin(), supportedEventNames.end(), ctx.eventName) != supportedEventNames.end()) {
38
+ eventEmitter->dispatchEvent(ctx.eventName, ArkJS(ctx.env).getDynamic(ctx.payload));
39
+ }
40
+ }
41
+ };
42
+
43
+
44
+ class BaseReactNativeAudioToolkitPackage : public Package {
45
+ public:
46
+ BaseReactNativeAudioToolkitPackage(Package::Context ctx) : Package(ctx){};
47
+
48
+ std::unique_ptr<TurboModuleFactoryDelegate> createTurboModuleFactoryDelegate() override {
49
+ return std::make_unique<BaseReactNativeAudioToolkitPackageTurboModuleFactoryDelegate>();
50
+ }
51
+
52
+ std::vector<facebook::react::ComponentDescriptorProvider> createComponentDescriptorProviders() override {
53
+ return {
54
+ };
55
+ }
56
+
57
+ ComponentJSIBinderByString createComponentJSIBinderByName() override {
58
+ return {
59
+ };
60
+ };
61
+
62
+ EventEmitRequestHandlers createEventEmitRequestHandlers() override {
63
+ return {
64
+ std::make_shared<BaseReactNativeAudioToolkitPackageEventEmitRequestHandler>(),
65
+ };
66
+ }
67
+ };
68
+
69
+ } // namespace rnoh
@@ -0,0 +1,23 @@
1
+ /**
2
+ * This code was generated by "react-native codegen-lib-harmony"
3
+ */
4
+
5
+ #include "RCTAudioPlayer.h"
6
+
7
+ namespace rnoh {
8
+ using namespace facebook;
9
+
10
+ RCTAudioPlayer::RCTAudioPlayer(const ArkTSTurboModule::Context ctx, const std::string name) : ArkTSTurboModule(ctx, name) {
11
+ methodMap_ = {
12
+ ARK_METHOD_METADATA(set, 3),
13
+ ARK_METHOD_METADATA(prepare, 4),
14
+ ARK_METHOD_METADATA(play, 2),
15
+ ARK_METHOD_METADATA(pause, 0),
16
+ ARK_METHOD_METADATA(stop, 0),
17
+ ARK_METHOD_METADATA(destroy, 1),
18
+ ARK_METHOD_METADATA(seek, 0),
19
+ ARK_METHOD_METADATA(getCurrentTime, 2),
20
+ };
21
+ }
22
+
23
+ } // namespace rnoh
@@ -0,0 +1,16 @@
1
+ /**
2
+ * This code was generated by "react-native codegen-lib-harmony"
3
+ */
4
+
5
+ #pragma once
6
+
7
+ #include "RNOH/ArkTSTurboModule.h"
8
+
9
+ namespace rnoh {
10
+
11
+ class JSI_EXPORT RCTAudioPlayer : public ArkTSTurboModule {
12
+ public:
13
+ RCTAudioPlayer(const ArkTSTurboModule::Context ctx, const std::string name);
14
+ };
15
+
16
+ } // namespace rnoh
@@ -0,0 +1,20 @@
1
+ /**
2
+ * This code was generated by "react-native codegen-lib-harmony"
3
+ */
4
+
5
+ #include "RCTAudioRecorder.h"
6
+
7
+ namespace rnoh {
8
+ using namespace facebook;
9
+
10
+ RCTAudioRecorder::RCTAudioRecorder(const ArkTSTurboModule::Context ctx, const std::string name) : ArkTSTurboModule(ctx, name) {
11
+ methodMap_ = {
12
+ ARK_METHOD_METADATA(prepare, 4),
13
+ ARK_METHOD_METADATA(record, 2),
14
+ ARK_METHOD_METADATA(stop, 2),
15
+ ARK_METHOD_METADATA(pause, 2),
16
+ ARK_METHOD_METADATA(destroy, 2),
17
+ };
18
+ }
19
+
20
+ } // namespace rnoh
@@ -0,0 +1,16 @@
1
+ /**
2
+ * This code was generated by "react-native codegen-lib-harmony"
3
+ */
4
+
5
+ #pragma once
6
+
7
+ #include "RNOH/ArkTSTurboModule.h"
8
+
9
+ namespace rnoh {
10
+
11
+ class JSI_EXPORT RCTAudioRecorder : public ArkTSTurboModule {
12
+ public:
13
+ RCTAudioRecorder(const ArkTSTurboModule::Context ctx, const std::string name);
14
+ };
15
+
16
+ } // namespace rnoh
@@ -0,0 +1,22 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateComponentDescriptorH.js
9
+ */
10
+
11
+ #pragma once
12
+
13
+ #include <react/renderer/components/react_native_audio_toolkit/ShadowNodes.h>
14
+ #include <react/renderer/core/ConcreteComponentDescriptor.h>
15
+
16
+ namespace facebook {
17
+ namespace react {
18
+
19
+
20
+
21
+ } // namespace react
22
+ } // namespace facebook