@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
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2015-present, Facebook, Inc.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,33 +0,0 @@
1
- OPEN SOURCE SOFTWARE NOTICE
2
-
3
- Please note we provide an open source software notice for the third party open source software along with this software and/or this software component (in the following just “this SOFTWARE”). The open source software licenses are granted by the respective right holders.
4
-
5
- Warranty Disclaimer
6
- THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
7
-
8
- Copyright Notice and License Texts
9
-
10
- ----------------------------------------------------------------------
11
- Software: @react-native-clipboard/clipboard V1.12.1
12
-
13
- MIT License
14
-
15
- Copyright (c) 2015-present, Facebook, Inc.
16
-
17
- Permission is hereby granted, free of charge, to any person obtaining a copy
18
- of this software and associated documentation files (the "Software"), to deal
19
- in the Software without restriction, including without limitation the rights
20
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
21
- copies of the Software, and to permit persons to whom the Software is
22
- furnished to do so, subject to the following conditions:
23
-
24
- The above copyright notice and this permission notice shall be included in all
25
- copies or substantial portions of the Software.
26
-
27
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
30
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
32
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
- SOFTWARE.
@@ -1,11 +0,0 @@
1
- [
2
- {
3
- "Name": "@react-native-clipboard/clipboard",
4
- "License": "MIT License",
5
- "License File": "https://github.com/react-native-clipboard/clipboard/blob/master/LICENSE",
6
- "Version Number": "1.12.1",
7
- "Owner" : "M.Haris Baig <harisbaig100@gmail.com>"
8
- "Upstream URL": "https://github.com/react-native-clipboard/clipboard",
9
- "Description": "React Native Clipboard API for macOS, iOS, Android, and Windows."
10
- }
11
- ]
@@ -1,230 +0,0 @@
1
- > 模板版本:v0.0.2
2
-
3
- <p align="center">
4
- <h1 align="center"> <code>@react-native-clipboard/clipboard</code> </h1>
5
- </p>
6
- <p align="center">
7
- <a href="https://github.com/react-native-clipboard/clipboard">
8
- <img src="https://img.shields.io/badge/platforms-android%20|%20ios%20|%20macos%20|%20windows%20|%20harmony%20-lightgrey.svg" alt="Supported platforms" />
9
- </a>
10
- <a href="https://github.com/react-native-clipboard/clipboard/blob/master/LICENSE">
11
- <img src="https://img.shields.io/badge/license-MIT-green.svg" alt="License" />
12
- </a>
13
- </p>
14
-
15
- ## 安装与使用
16
-
17
- > [!tip] 目前部分 React-Native-OpenHarmony(RNOH) 三方库的 npm 包部署在私仓,需要通过 github token 来获取访问权限。
18
-
19
- 在与 `package.json` 文件相同的目录中,创建或编辑 `.npmrc` 文件以包含指定 GitHub Packages URL 和托管包的命名空间的行。 将 TOKEN 替换为 RNOH 三方库指定的 token。
20
-
21
- ```bash
22
- @react-native-oh-library:registry=https://npm.pkg.github.com
23
- //npm.pkg.github.com/:_authToken=TOKEN
24
- ```
25
-
26
- 进入到工程目录并输入以下命令:
27
-
28
- <!-- tabs:start -->
29
-
30
- #### **yarn**
31
-
32
- ```bash
33
- yarn add @react-native-clipboard/clipboard@npm:@react-native-oh-library/clipboard
34
- ```
35
-
36
- #### **npm**
37
-
38
- ```bash
39
- npm install @react-native-clipboard/clipboard@npm:@react-native-oh-library/clipboard
40
- ```
41
-
42
- <!-- tabs:end -->
43
-
44
- 下面的代码展示了这个库的基本使用场景:
45
-
46
- ```js
47
- import Clipboard from "@react-native-clipboard/clipboard";
48
-
49
- const [copiedText, setCopiedText] = useState("");
50
-
51
- const copyToClipboard = () => {
52
- Clipboard.setString("hello world");
53
- };
54
-
55
- const fetchCopiedText = async () => {
56
- const text = await Clipboard.getString();
57
- setCopiedText(text);
58
- };
59
-
60
- <View style={styles.container}>
61
- <TouchableOpacity onPress={copyToClipboard}>
62
- <Text>Click here to copy to Clipboard</Text>
63
- </TouchableOpacity>
64
- <TouchableOpacity onPress={fetchCopiedText}>
65
- <Text>View copied text</Text>
66
- </TouchableOpacity>
67
-
68
- <Text style={styles.copiedText}>{copiedText}</Text>
69
- </View>;
70
- ```
71
-
72
- ## Link
73
-
74
- 目前鸿蒙暂不支持 AutoLink,所以 Link 步骤需要手动配置。
75
-
76
- 首先需要使用 DevEco Studio 打开项目里的鸿蒙工程 `harmony`
77
-
78
- ### 引入原生端代码
79
-
80
- 目前有两种方法:
81
-
82
- 1. 通过 har 包引入(在 IDE 完善相关功能后该方法会被遗弃,目前首选此方法);
83
- 2. 直接链接源码。
84
-
85
- 方法一:通过 har 包引入
86
- 打开 `entry/oh-package.json5`,添加以下依赖
87
-
88
- ```json
89
- "dependencies": {
90
- "rnoh": "file:../rnoh",
91
- "rnoh-clipboard": "file:../../node_modules/@react-native-clipboard/clipboard/harmony/clipboard.har"
92
- }
93
- ```
94
-
95
- 点击右上角的 `sync` 按钮
96
-
97
- 或者在终端执行:
98
-
99
- ```bash
100
- cd entry
101
- ohpm install
102
- ```
103
-
104
- 方法二:直接链接源码
105
- 打开 `entry/oh-package.json5`,添加以下依赖
106
-
107
- ```json
108
- "dependencies": {
109
- "rnoh": "file:../rnoh",
110
- "rnoh-clipboard": "file:../../node_modules/@react-native-clipboard/clipboard/harmony/clipboard"
111
- }
112
- ```
113
-
114
- 打开终端,执行:
115
-
116
- ```bash
117
- cd entry
118
- ohpm install --no-link
119
- ```
120
-
121
- ### 配置 CMakeLists 和引入 ClipboardPackage
122
-
123
- 打开 `entry/src/main/cpp/CMakeLists.txt`,添加:
124
-
125
- ```diff
126
- project(rnapp)
127
- cmake_minimum_required(VERSION 3.4.1)
128
- set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
129
- set(OH_MODULE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules")
130
- set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../react-native-harmony/harmony/cpp")
131
-
132
- add_subdirectory("${RNOH_CPP_DIR}" ./rn)
133
-
134
- # RNOH_BEGIN: add_package_subdirectories
135
- add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package)
136
- + add_subdirectory("${OH_MODULE_DIR}/rnoh-clipboard/src/main/cpp" ./clipboard)
137
- # RNOH_END: add_package_subdirectories
138
-
139
- add_library(rnoh_app SHARED
140
- "./PackageProvider.cpp"
141
- "${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp"
142
- )
143
-
144
- target_link_libraries(rnoh_app PUBLIC rnoh)
145
-
146
- # RNOH_BEGIN: link_packages
147
- target_link_libraries(rnoh_app PUBLIC rnoh_sample_package)
148
- + target_link_libraries(rnoh_app PUBLIC rnoh_clipboard)
149
- # RNOH_END: link_packages
150
- ```
151
-
152
- 打开 `entry/src/main/cpp/PackageProvider.cpp`,添加:
153
-
154
- ```diff
155
- #include "RNOH/PackageProvider.h"
156
- #include "SamplePackage.h"
157
- + #include "ClipboardPackage.h"
158
-
159
- using namespace rnoh;
160
-
161
- std::vector<std::shared_ptr<Package>> PackageProvider::getPackages(Package::Context ctx) {
162
- return {
163
- std::make_shared<SamplePackage>(ctx),
164
- + std::make_shared<ClipboardPackage>(ctx)
165
- };
166
- }
167
- ```
168
-
169
- ### 在 ArkTs 侧引入 Clipboard Package
170
-
171
- 打开 `entry/src/main/ets/RNPackagesFactory.ts`,添加:
172
-
173
- ```diff
174
- import type {RNPackageContext, RNPackage} from 'rnoh/ts';
175
- import {SamplePackage} from 'rnoh-sample-package/ts';
176
- + import {ClipboardPackage} from 'rnoh-clipboard/ts';
177
-
178
- export function createRNPackages(ctx: RNPackageContext): RNPackage[] {
179
- return [
180
- new SamplePackage(ctx),
181
- + new ClipboardPackage(ctx)
182
- ];
183
- }
184
-
185
- ```
186
-
187
- ### 运行
188
-
189
- 点击右上角的 `sync` 按钮
190
-
191
- 或者在终端执行:
192
-
193
- ```bash
194
- cd entry
195
- ohpm install
196
- ```
197
-
198
- 然后编译、运行即可。
199
-
200
- ## 兼容性
201
-
202
- 要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。
203
-
204
- 请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[@react-native-oh-library/clipboard Releases](https://github.com/react-native-oh-library/clipboard/releases)
205
-
206
- ## 属性
207
-
208
- | 名称 | 说明 | 类型 | 是否必填 | 原库平台 | 鸿蒙支持 |
209
- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | -------- | ----------- | -------- |
210
- | getString | Get content of string type, this method returns a Promise, so you can use following code to get clipboard content | function | NO | ios,android | yes |
211
- | setString | Set content of string type. You can use following code to set clipboard content | function | NO | ios,android | yes |
212
- | hasString | Returns whether the clipboard has content or is empty. | function | NO | ios,android | yes |
213
- | getImage | Get content of image in base64 string type, this method returns a Promise, so you can use following code to get clipboard content (ANDROID only) | function | NO | android | no |
214
- | getStrings | (iOS only) Get contents of string array type, this method returns a Promise, so you can use following code to get clipboard content | function | NO | ios | yes |
215
- | setStrings | (iOS only) Set content of string array type. You can use following code to set clipboard content | function | NO | ios | yes |
216
- | hasNumber | (iOS 14+ only) Returns whether the clipboard has a Number(UIPasteboardDetectionPatternNumber) content. Can check if there is a Number content in clipboard without triggering PasteBoard notification for iOS 14+ | function | NO | ios | yes |
217
- | hasImage | Returns whether the clipboard has a Image | function | NO | ios | no |
218
- | hasUrl | (iOS only) Returns whether the clipboard has a URL content. Can check if there is a URL content in clipboard without triggering PasteBoard notification for iOS 14+ | function | NO | ios | no |
219
- | hasWebUrl | (iOS 14+ only) Returns whether the clipboard has a WebURL(UIPasteboardDetectionPatternProbableWebURL) content. Can check if there is a WebURL content in clipboard without triggering PasteBoard notification for iOS 14+ | function | NO | ios | yes |
220
- | setImage | Set content of Image type.(base64 string) | function | NO | ios | no |
221
- | getImageJPG | get base64 string of JPG Image | function | NO | ios | no |
222
- | getImagePNG | get base64 string of PNG Image | function | NO | ios | no |
223
-
224
- ## 遗留问题
225
-
226
- ## 其他
227
-
228
- ## 开源协议
229
-
230
- 本项目基于 [The MIT License (MIT)](https://github.com/react-native-oh-library/clipboard/blob/harmony/LICENSE) ,请自由地享受和参与开源。