@react-native-ohos/audio-toolkit 2.1.0-rc.1 → 2.1.0-rc.2

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 (49) hide show
  1. package/CHANGELOG.md +6 -136
  2. package/COMMITTERS.md +6 -6
  3. package/LICENSE +22 -22
  4. package/ReactNativeAudioToolkit.podspec +18 -18
  5. package/harmony/audio_toolkit/LICENSE +20 -20
  6. package/harmony/audio_toolkit/NOTICE +32 -32
  7. package/harmony/audio_toolkit/OAT.xml +37 -37
  8. package/harmony/audio_toolkit/README.OpenSource +10 -10
  9. package/harmony/audio_toolkit/README.md +16 -16
  10. package/harmony/audio_toolkit/build-profile.json5 +7 -7
  11. package/harmony/audio_toolkit/hvigorfile.ts +1 -1
  12. package/harmony/audio_toolkit/index.ets +24 -24
  13. package/harmony/audio_toolkit/oh-package.json5 +12 -12
  14. package/harmony/audio_toolkit/src/main/cpp/generated/RNOH/generated/BaseAudioToolkitPackage.h +76 -76
  15. package/harmony/audio_toolkit/src/main/cpp/generated/RNOH/generated/turbo_modules/RCTAudioPlayer.cpp +23 -23
  16. package/harmony/audio_toolkit/src/main/cpp/generated/RNOH/generated/turbo_modules/RCTAudioPlayer.h +16 -16
  17. package/harmony/audio_toolkit/src/main/cpp/generated/RNOH/generated/turbo_modules/RCTAudioRecorder.cpp +20 -20
  18. package/harmony/audio_toolkit/src/main/cpp/generated/RNOH/generated/turbo_modules/RCTAudioRecorder.h +16 -16
  19. package/harmony/audio_toolkit/src/main/cpp/generated/react/renderer/components/audio_toolkit/ComponentDescriptors.h +24 -24
  20. package/harmony/audio_toolkit/src/main/cpp/generated/react/renderer/components/audio_toolkit/EventEmitters.cpp +16 -16
  21. package/harmony/audio_toolkit/src/main/cpp/generated/react/renderer/components/audio_toolkit/EventEmitters.h +17 -17
  22. package/harmony/audio_toolkit/src/main/cpp/generated/react/renderer/components/audio_toolkit/Props.cpp +19 -19
  23. package/harmony/audio_toolkit/src/main/cpp/generated/react/renderer/components/audio_toolkit/Props.h +18 -18
  24. package/harmony/audio_toolkit/src/main/cpp/generated/react/renderer/components/audio_toolkit/ShadowNodes.cpp +17 -17
  25. package/harmony/audio_toolkit/src/main/cpp/generated/react/renderer/components/audio_toolkit/ShadowNodes.h +23 -23
  26. package/harmony/audio_toolkit/src/main/cpp/generated/react/renderer/components/audio_toolkit/States.cpp +16 -16
  27. package/harmony/audio_toolkit/src/main/cpp/generated/react/renderer/components/audio_toolkit/States.h +18 -18
  28. package/harmony/audio_toolkit/src/main/ets/AudioToolkitPackage.ts +50 -50
  29. package/harmony/audio_toolkit/src/main/ets/Logger.ts +63 -63
  30. package/harmony/audio_toolkit/src/main/ets/RNCAudioPlayerTurboModule.ts +518 -432
  31. package/harmony/audio_toolkit/src/main/ets/RNCAudioRecorderTurboModule.ts +260 -260
  32. package/harmony/audio_toolkit/src/main/ets/generated/components/ts.ts +5 -5
  33. package/harmony/audio_toolkit/src/main/ets/generated/index.ets +5 -5
  34. package/harmony/audio_toolkit/src/main/ets/generated/ts.ts +6 -6
  35. package/harmony/audio_toolkit/src/main/ets/generated/turboModules/RCTAudioPlayer.ts +40 -40
  36. package/harmony/audio_toolkit/src/main/ets/generated/turboModules/RCTAudioRecorder.ts +24 -24
  37. package/harmony/audio_toolkit/src/main/ets/generated/turboModules/ts.ts +6 -6
  38. package/harmony/audio_toolkit/src/main/module.json5 +6 -6
  39. package/harmony/audio_toolkit/src/main/resources/base/element/string.json +7 -7
  40. package/harmony/audio_toolkit/src/main/resources/en_US/element/string.json +7 -7
  41. package/harmony/audio_toolkit/src/main/resources/zh_CN/element/string.json +7 -7
  42. package/harmony/audio_toolkit/ts.ts +25 -25
  43. package/harmony/audio_toolkit.har +0 -0
  44. package/package.json +47 -47
  45. package/src/Player.js +329 -329
  46. package/src/PlayerModule.ts +51 -51
  47. package/src/Recorder.js +183 -183
  48. package/src/RecorderModule.ts +83 -83
  49. package/src/index.ts +5 -5
@@ -1,51 +1,51 @@
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
- import { RNPackage, TurboModulesFactory } from '@rnoh/react-native-openharmony/ts';
26
- import type { TurboModule, TurboModuleContext } from '@rnoh/react-native-openharmony/ts';
27
- import { RCTAudioPlayerTurboModule } from './RNCAudioPlayerTurboModule';
28
- import { RCTAudioRecorderTurboModule } from './RNCAudioRecorderTurboModule';
29
- export const AUDIO_TYPE: string = 'RCTAudioPlayer1';
30
-
31
- class AudioPlayer1TurboModulesFactory extends TurboModulesFactory {
32
- createTurboModule(name: string): TurboModule | null {
33
- if (name === 'RCTAudioPlayer') {
34
- return new RCTAudioPlayerTurboModule(this.ctx);
35
- }
36
- if (name === 'RCTAudioRecorder') {
37
- return new RCTAudioRecorderTurboModule(this.ctx);
38
- }
39
- return null;
40
- }
41
-
42
- hasTurboModule(name: string): boolean {
43
- return name === 'RCTAudioPlayer' || name === 'RCTAudioRecorder';
44
- }
45
- }
46
-
47
- export class AudioModulesPackage extends RNPackage {
48
- createTurboModulesFactory(ctx: TurboModuleContext): TurboModulesFactory {
49
- return new AudioPlayer1TurboModulesFactory(ctx);
50
- }
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
+ import { RNPackage, TurboModulesFactory } from '@rnoh/react-native-openharmony/ts';
26
+ import type { TurboModule, TurboModuleContext } from '@rnoh/react-native-openharmony/ts';
27
+ import { RCTAudioPlayerTurboModule } from './RNCAudioPlayerTurboModule';
28
+ import { RCTAudioRecorderTurboModule } from './RNCAudioRecorderTurboModule';
29
+ export const AUDIO_TYPE: string = 'RCTAudioPlayer1';
30
+
31
+ class AudioPlayer1TurboModulesFactory extends TurboModulesFactory {
32
+ createTurboModule(name: string): TurboModule | null {
33
+ if (name === 'RCTAudioPlayer') {
34
+ return new RCTAudioPlayerTurboModule(this.ctx);
35
+ }
36
+ if (name === 'RCTAudioRecorder') {
37
+ return new RCTAudioRecorderTurboModule(this.ctx);
38
+ }
39
+ return null;
40
+ }
41
+
42
+ hasTurboModule(name: string): boolean {
43
+ return name === 'RCTAudioPlayer' || name === 'RCTAudioRecorder';
44
+ }
45
+ }
46
+
47
+ export class AudioModulesPackage extends RNPackage {
48
+ createTurboModulesFactory(ctx: TurboModuleContext): TurboModulesFactory {
49
+ return new AudioPlayer1TurboModulesFactory(ctx);
50
+ }
51
51
  }
@@ -1,64 +1,64 @@
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
- import hilog from '@ohos.hilog';
26
-
27
- class Logger {
28
- private domain: number;
29
- private prefix: string;
30
- private format: string = '%{public}s';
31
- private isDebug: boolean;
32
-
33
- /**
34
- * constructor.
35
- *
36
- * @param Prefix Identifies the log tag.
37
- * @param domain Domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFFF.
38
- */
39
- constructor(prefix: string = 'MyApp', domain: number = 0xFF00, isDebug = false) {
40
- this.prefix = prefix;
41
- this.domain = domain;
42
- this.isDebug = isDebug;
43
- }
44
-
45
- debug(...args: string[]): void {
46
- if (this.isDebug) {
47
- hilog.debug(this.domain, this.prefix, this.format, args);
48
- }
49
- }
50
-
51
- info(...args: string[]): void {
52
- hilog.info(this.domain, this.prefix, this.format, args);
53
- }
54
-
55
- warn(...args: string[]): void {
56
- hilog.warn(this.domain, this.prefix, this.format, args);
57
- }
58
-
59
- error(...args: string[]): void {
60
- hilog.error(this.domain, this.prefix, this.format, args);
61
- }
62
- }
63
-
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
+ import hilog from '@ohos.hilog';
26
+
27
+ class Logger {
28
+ private domain: number;
29
+ private prefix: string;
30
+ private format: string = '%{public}s';
31
+ private isDebug: boolean;
32
+
33
+ /**
34
+ * constructor.
35
+ *
36
+ * @param Prefix Identifies the log tag.
37
+ * @param domain Domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFFF.
38
+ */
39
+ constructor(prefix: string = 'MyApp', domain: number = 0xFF00, isDebug = false) {
40
+ this.prefix = prefix;
41
+ this.domain = domain;
42
+ this.isDebug = isDebug;
43
+ }
44
+
45
+ debug(...args: string[]): void {
46
+ if (this.isDebug) {
47
+ hilog.debug(this.domain, this.prefix, this.format, args);
48
+ }
49
+ }
50
+
51
+ info(...args: string[]): void {
52
+ hilog.info(this.domain, this.prefix, this.format, args);
53
+ }
54
+
55
+ warn(...args: string[]): void {
56
+ hilog.warn(this.domain, this.prefix, this.format, args);
57
+ }
58
+
59
+ error(...args: string[]): void {
60
+ hilog.error(this.domain, this.prefix, this.format, args);
61
+ }
62
+ }
63
+
64
64
  export default new Logger('AudioToolkit', 0xFF00, false)