expo-nodemediaclient 0.1.2 → 0.2.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.
Files changed (35) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/CLAUDE.md +55 -0
  3. package/README.md +203 -19
  4. package/android/build.gradle +6 -7
  5. package/android/src/main/java/expo/modules/nodemediaclient/ExpoNodeMediaClientModule.kt +1 -1
  6. package/android/src/main/java/expo/modules/nodemediaclient/ExpoNodePlayerView.kt +15 -20
  7. package/android/src/main/java/expo/modules/nodemediaclient/ExpoNodePlayerViewModule.kt +58 -0
  8. package/android/src/main/java/expo/modules/nodemediaclient/ExpoNodePublisherView.kt +175 -0
  9. package/android/src/main/java/expo/modules/nodemediaclient/ExpoNodePublisherViewModule.kt +111 -0
  10. package/build/ExpoNodeMediaClientModule.js.map +1 -1
  11. package/build/ExpoNodePlayerView.d.ts +9 -3
  12. package/build/ExpoNodePlayerView.d.ts.map +1 -1
  13. package/build/ExpoNodePlayerView.js +3 -18
  14. package/build/ExpoNodePlayerView.js.map +1 -1
  15. package/build/ExpoNodePublisherView.d.ts +91 -0
  16. package/build/ExpoNodePublisherView.d.ts.map +1 -0
  17. package/build/ExpoNodePublisherView.js +44 -0
  18. package/build/ExpoNodePublisherView.js.map +1 -0
  19. package/build/index.d.ts +2 -1
  20. package/build/index.d.ts.map +1 -1
  21. package/build/index.js +3 -5
  22. package/build/index.js.map +1 -1
  23. package/expo-module.config.json +4 -2
  24. package/ios/ExpoNodeMediaClientModule.swift +1 -1
  25. package/ios/ExpoNodePlayerView.swift +76 -70
  26. package/ios/{ExpoNodePlayerModule.swift → ExpoNodePlayerViewModule.swift} +8 -6
  27. package/ios/ExpoNodePublisherView.swift +174 -0
  28. package/ios/ExpoNodePublisherViewModule.swift +114 -0
  29. package/ios/ExpoNodemediaclient.podspec +2 -3
  30. package/package.json +1 -1
  31. package/src/ExpoNodeMediaClientModule.tsx +1 -1
  32. package/src/ExpoNodePlayerView.tsx +12 -25
  33. package/src/ExpoNodePublisherView.tsx +99 -0
  34. package/src/index.ts +4 -7
  35. package/android/src/main/java/expo/modules/nodemediaclient/ExpoNodePlayerModule.kt +0 -60
@@ -0,0 +1,111 @@
1
+ package expo.modules.nodemediaclient
2
+
3
+ import expo.modules.kotlin.modules.Module
4
+ import expo.modules.kotlin.modules.ModuleDefinition
5
+
6
+ class ExpoNodePublisherViewModule : Module() {
7
+ override fun definition() = ModuleDefinition {
8
+ Name("ExpoNodePublisherView")
9
+
10
+ View(ExpoNodePublisherView::class) {
11
+ Events("onEventCallback")
12
+
13
+ Prop("url") { view: ExpoNodePublisherView, url: String ->
14
+ view.url = url
15
+ }
16
+
17
+ Prop("cryptoKey") { view: ExpoNodePublisherView, cryptoKey: String ->
18
+ view.cryptoKey = cryptoKey
19
+ }
20
+
21
+ Prop("HWAccelEnable") { view: ExpoNodePublisherView, HWAccelEnable: Boolean ->
22
+ view.HWAccelEnable = HWAccelEnable
23
+ }
24
+
25
+ // Audio parameters
26
+ Prop("audioParam") { view: ExpoNodePublisherView, audioParam: Map<String, Int> ->
27
+ view.audioCodecId = audioParam["codecid"] as Int
28
+ view.audioProfile = audioParam["profile"] as Int
29
+ view.audioChannels = audioParam["channels"] as Int
30
+ view.audioSamplingRate = audioParam["samplingRate"] as Int
31
+ view.audioBitrate = audioParam["bitrate"] as Int
32
+ }
33
+
34
+ // Video parameters
35
+ Prop("videoParam") { view: ExpoNodePublisherView, videoParam: Map<String, Int> ->
36
+ view.videoCodecId = videoParam["codecid"] as Int
37
+ view.videoProfile = videoParam["profile"] as Int
38
+ view.videoWidth = videoParam["width"] as Int
39
+ view.videoHeight = videoParam["height"] as Int
40
+ view.videoFps = videoParam["fps"] as Int
41
+ view.videoBitrate = videoParam["bitrate"] as Int
42
+ }
43
+
44
+ Prop("keyFrameInterval") { view: ExpoNodePublisherView, keyFrameInterval: Int ->
45
+ view.keyFrameInterval = keyFrameInterval
46
+ }
47
+
48
+ Prop("videoOrientation") { view: ExpoNodePublisherView, videoOrientation: Int ->
49
+ view.videoOrientation = videoOrientation
50
+ }
51
+
52
+ Prop("frontCamera") { view: ExpoNodePublisherView, frontCamera: Boolean ->
53
+ view.frontCamera = frontCamera
54
+ }
55
+
56
+ Prop("cameraFrontMirror") { view: ExpoNodePublisherView, cameraFrontMirror: Boolean ->
57
+ view.cameraFrontMirror = cameraFrontMirror
58
+ }
59
+
60
+ Prop("denoiseEnable") { view: ExpoNodePublisherView, denoiseEnable: Boolean ->
61
+ view.denoiseEnable = denoiseEnable
62
+ }
63
+
64
+ Prop("zoomRatio") { view: ExpoNodePublisherView, zoomRatio: Float ->
65
+ view.zoomRatio = zoomRatio
66
+ }
67
+
68
+ Prop("volume") { view: ExpoNodePublisherView, volume: Float ->
69
+ view.volume = volume
70
+ }
71
+
72
+ Prop("torchEnable") { view: ExpoNodePublisherView, torchEnable: Boolean ->
73
+ view.torchEnable = torchEnable
74
+ }
75
+
76
+ // Color and effect parameters
77
+ Prop("colorStyleId") { view: ExpoNodePublisherView, colorStyleId: Int ->
78
+ view.colorStyleId = colorStyleId
79
+ }
80
+
81
+ Prop("colorStyleIntensity") { view: ExpoNodePublisherView, colorStyleIntensity: Float ->
82
+ view.colorStyleIntensity = colorStyleIntensity
83
+ }
84
+
85
+ Prop("smoothskinIntensity") { view: ExpoNodePublisherView, smoothskinIntensity: Float ->
86
+ view.smoothskinIntensity = smoothskinIntensity
87
+ }
88
+
89
+ // Methods
90
+ AsyncFunction("start") { view: ExpoNodePublisherView, url: String? ->
91
+ view.start(url)
92
+ }
93
+
94
+ AsyncFunction("stop") { view: ExpoNodePublisherView ->
95
+ view.stop()
96
+ }
97
+
98
+ AsyncFunction("setEffectParameter") { view: ExpoNodePublisherView, key: String, value: Float ->
99
+ view.setEffectParameter(key, value)
100
+ }
101
+
102
+ AsyncFunction("setEffectStyle") { view: ExpoNodePublisherView, style: Int ->
103
+ view.setEffectStyle(style)
104
+ }
105
+
106
+ AsyncFunction("startFocusAndMeteringCenter") { view: ExpoNodePublisherView ->
107
+ view.startFocusAndMeteringCenter()
108
+ }
109
+ }
110
+ }
111
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoNodeMediaClientModule.js","sourceRoot":"","sources":["../src/ExpoNodeMediaClientModule.tsx"],"names":[],"mappings":"AAAA,EAAE;AACF,qDAAqD;AACrD,4CAA4C;AAC5C,wBAAwB;AACxB,EAAE;AAGF,OAAO,EAAgB,mBAAmB,EAAE,MAAM,MAAM,CAAC;AAMzD,yDAAyD;AACzD,eAAe,mBAAmB,CAA4B,2BAA2B,CAAC,CAAC","sourcesContent":["//\n// Copyright (c) 2025 NodeMedia Technology Co., Ltd.\n// Created by Chen Mingliang on 2025-07-22.\n// All rights reserved.\n//\n\n\nimport { NativeModule, requireNativeModule } from 'expo';\n\ndeclare class ExpoNodeMediaClientModule extends NativeModule{\n setLicense(license: string): void;\n}\n\n// This call loads the native module object from the JSI.\nexport default requireNativeModule<ExpoNodeMediaClientModule>('ExpoNodeMediaClientModule');\n"]}
1
+ {"version":3,"file":"ExpoNodeMediaClientModule.js","sourceRoot":"","sources":["../src/ExpoNodeMediaClientModule.tsx"],"names":[],"mappings":"AAAA,EAAE;AACF,qDAAqD;AACrD,4CAA4C;AAC5C,wBAAwB;AACxB,EAAE;AAGF,OAAO,EAAgB,mBAAmB,EAAE,MAAM,MAAM,CAAC;AAMzD,yDAAyD;AACzD,eAAe,mBAAmB,CAA4B,2BAA2B,CAAC,CAAC","sourcesContent":["//\n// Copyright (c) 2025 NodeMedia Technology Co., Ltd.\n// Created by Chen Mingliang on 2025-07-22.\n// All rights reserved.\n//\n\n\nimport { NativeModule, requireNativeModule } from 'expo';\n\ndeclare class ExpoNodeMediaClientModule extends NativeModule{\n setLicense(license: string): void;\n}\n\n// This call loads the native module object from the JSI.\nexport default requireNativeModule<ExpoNodeMediaClientModule>('ExpoNodeMediaClientModule');"]}
@@ -3,8 +3,12 @@ export type NodePlayerRef = {
3
3
  start: (url?: string) => void;
4
4
  stop: () => void;
5
5
  };
6
+ export type NodePlayerEventCallback = {
7
+ event: number;
8
+ msg: string;
9
+ };
6
10
  export type NodePlayerProps = {
7
- ref?: React.Ref<NodePlayerRef>;
11
+ ref?: NodePlayerRef;
8
12
  url?: string;
9
13
  volume?: number;
10
14
  cryptoKey?: string;
@@ -14,7 +18,9 @@ export type NodePlayerProps = {
14
18
  HTTPUserAgent?: string;
15
19
  RTSPTransport?: string;
16
20
  HWAccelEnable?: boolean;
21
+ onEventCallback?: (event: {
22
+ nativeEvent: NodePlayerEventCallback;
23
+ }) => void;
17
24
  } & ViewProps;
18
- declare const _default: import("react").ForwardRefExoticComponent<Omit<NodePlayerProps, "ref"> & import("react").RefAttributes<NodePlayerRef>>;
19
- export default _default;
25
+ export default function ExpoNodePlayerView(props: NodePlayerProps): import("react").JSX.Element;
20
26
  //# sourceMappingURL=ExpoNodePlayerView.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoNodePlayerView.d.ts","sourceRoot":"","sources":["../src/ExpoNodePlayerView.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAC,MAAM,cAAc,CAAC;AAIxC,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,CAAC,GAAG,CAAC,EAAC,MAAM,KAAK,IAAI,CAAC;IAC7B,IAAI,EAAE,MAAM,IAAI,CAAC;CAClB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IAC/B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,GAAG,SAAS,CAAC;;AAId,wBAaG"}
1
+ {"version":3,"file":"ExpoNodePlayerView.d.ts","sourceRoot":"","sources":["../src/ExpoNodePlayerView.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,CAAC,GAAG,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9B,IAAI,EAAE,MAAM,IAAI,CAAC;CAClB,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,GAAG,CAAC,EAAE,aAAa,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,WAAW,EAAE,uBAAuB,CAAA;KAAE,KAAK,IAAI,CAAC;CAC7E,GAAG,SAAS,CAAC;AAGd,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,KAAK,EAAE,eAAe,+BAEhE"}
@@ -1,21 +1,6 @@
1
- //
2
- // Copyright (c) 2025 NodeMedia Technology Co., Ltd.
3
- // Created by Chen Mingliang on 2025-07-22.
4
- // All rights reserved.
5
- //
6
1
  import { requireNativeViewManager } from 'expo-modules-core';
7
- import { forwardRef, useImperativeHandle, useRef } from 'react';
8
2
  const NativeView = requireNativeViewManager('ExpoNodePlayerView');
9
- export default forwardRef((props, ref) => {
10
- const nativeRef = useRef(null);
11
- useImperativeHandle(ref, () => ({
12
- start: (url) => {
13
- nativeRef.current?.start(url);
14
- },
15
- stop: () => {
16
- nativeRef.current?.stop();
17
- }
18
- }));
19
- return <NativeView ref={nativeRef} {...props}/>;
20
- });
3
+ export default function ExpoNodePlayerView(props) {
4
+ return <NativeView {...props}/>;
5
+ }
21
6
  //# sourceMappingURL=ExpoNodePlayerView.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoNodePlayerView.js","sourceRoot":"","sources":["../src/ExpoNodePlayerView.tsx"],"names":[],"mappings":"AAAA,EAAE;AACF,qDAAqD;AACrD,4CAA4C;AAC5C,wBAAwB;AACxB,EAAE;AAGF,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAoBhE,MAAM,UAAU,GAAyC,wBAAwB,CAAC,oBAAoB,CAAC,CAAC;AAExG,eAAe,UAAU,CAAiC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACvE,MAAM,SAAS,GAAG,MAAM,CAAgB,IAAI,CAAC,CAAC;IAE9C,mBAAmB,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;QAC9B,KAAK,EAAE,CAAC,GAAW,EAAE,EAAE;YACrB,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;QAChC,CAAC;QACD,IAAI,EAAE,GAAG,EAAE;YACT,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC;QAC5B,CAAC;KACF,CAAC,CAAC,CAAC;IAEJ,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AACnD,CAAC,CAAC,CAAC","sourcesContent":["//\n// Copyright (c) 2025 NodeMedia Technology Co., Ltd.\n// Created by Chen Mingliang on 2025-07-22.\n// All rights reserved.\n//\n\nimport { ViewProps} from 'react-native';\nimport { requireNativeViewManager } from 'expo-modules-core';\nimport { forwardRef, useImperativeHandle, useRef } from 'react';\n\nexport type NodePlayerRef = {\n start: (url?:string) => void;\n stop: () => void;\n}\n\nexport type NodePlayerProps = {\n ref?: React.Ref<NodePlayerRef>;\n url?: string;\n volume?: number;\n cryptoKey?: string;\n scaleMode?: number;\n bufferTime?: number;\n HTTPReferer?: string;\n HTTPUserAgent?: string;\n RTSPTransport?: string;\n HWAccelEnable?: boolean;\n} & ViewProps;\n\nconst NativeView: React.ComponentType<NodePlayerProps> = requireNativeViewManager('ExpoNodePlayerView');\n\nexport default forwardRef<NodePlayerRef, NodePlayerProps>((props, ref) => {\n const nativeRef = useRef<NodePlayerRef>(null);\n\n useImperativeHandle(ref, () => ({\n start: (url?:string) => {\n nativeRef.current?.start(url);\n },\n stop: () => {\n nativeRef.current?.stop();\n }\n }));\n\n return <NativeView ref={nativeRef} {...props} />;\n});\n\n"]}
1
+ {"version":3,"file":"ExpoNodePlayerView.js","sourceRoot":"","sources":["../src/ExpoNodePlayerView.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AA0B7D,MAAM,UAAU,GAAyC,wBAAwB,CAAC,oBAAoB,CAAC,CAAC;AACxG,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,KAAsB;IAC/D,OAAO,CAAC,UAAU,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AACnC,CAAC","sourcesContent":["\nimport { ViewProps } from 'react-native';\nimport { requireNativeViewManager } from 'expo-modules-core';\n\nexport type NodePlayerRef = {\n start: (url?: string) => void;\n stop: () => void;\n}\n\nexport type NodePlayerEventCallback = {\n event: number;\n msg: string;\n}\n\nexport type NodePlayerProps = {\n ref?: NodePlayerRef;\n url?: string;\n volume?: number;\n cryptoKey?: string;\n scaleMode?: number;\n bufferTime?: number;\n HTTPReferer?: string;\n HTTPUserAgent?: string;\n RTSPTransport?: string;\n HWAccelEnable?: boolean;\n onEventCallback?: (event: { nativeEvent: NodePlayerEventCallback }) => void;\n} & ViewProps;\n\nconst NativeView: React.ComponentType<NodePlayerProps> = requireNativeViewManager('ExpoNodePlayerView');\nexport default function ExpoNodePlayerView(props: NodePlayerProps) {\n return <NativeView {...props} />;\n}"]}
@@ -0,0 +1,91 @@
1
+ import { ViewProps } from 'react-native';
2
+ export type NodePublisherRef = {
3
+ start: (url?: string) => Promise<void>;
4
+ stop: () => Promise<void>;
5
+ setEffectParameter: (key: string, value: number) => Promise<void>;
6
+ setEffectStyle: (style: number) => Promise<void>;
7
+ startFocusAndMeteringCenter: () => Promise<void>;
8
+ };
9
+ export type NodePublisherEventCallback = {
10
+ event: number;
11
+ msg: string;
12
+ };
13
+ export type AudioParam = {
14
+ codecid?: number;
15
+ profile?: number;
16
+ samplingRate?: number;
17
+ channels?: number;
18
+ bitrate?: number;
19
+ };
20
+ export type VideoParam = {
21
+ codecid?: number;
22
+ profile?: number;
23
+ width?: number;
24
+ height?: number;
25
+ fps?: number;
26
+ bitrate?: number;
27
+ };
28
+ export type NodePublisherProps = {
29
+ ref?: NodePublisherRef;
30
+ url?: string;
31
+ cryptoKey?: string;
32
+ audioParam?: AudioParam;
33
+ videoParam?: VideoParam;
34
+ keyFrameInterval?: number;
35
+ videoOrientation?: number;
36
+ frontCamera?: boolean;
37
+ cameraFrontMirror?: boolean;
38
+ zoomRatio?: number;
39
+ volume?: number;
40
+ torchEnable?: boolean;
41
+ HWAccelEnable?: boolean;
42
+ denoiseEnable?: boolean;
43
+ colorStyleId?: number;
44
+ colorStyleIntensity?: number;
45
+ smoothskinIntensity?: number;
46
+ onEventCallback?: (event: {
47
+ nativeEvent: NodePublisherEventCallback;
48
+ }) => void;
49
+ } & ViewProps;
50
+ declare function ExpoNodePublisherView(props: NodePublisherProps): import("react").JSX.Element;
51
+ declare namespace ExpoNodePublisherView {
52
+ var NMC_CODEC_ID_H264: number;
53
+ var NMC_CODEC_ID_H265: number;
54
+ var NMC_CODEC_ID_AAC: number;
55
+ var NMC_CODEC_ID_OPUS: number;
56
+ var NMC_CODEC_ID_PCMA: number;
57
+ var NMC_CODEC_ID_PCMU: number;
58
+ var NMC_PROFILE_AUTO: number;
59
+ var NMC_PROFILE_H264_BASELINE: number;
60
+ var NMC_PROFILE_H264_MAIN: number;
61
+ var NMC_PROFILE_H264_HIGH: number;
62
+ var NMC_PROFILE_H265_MAIN: number;
63
+ var NMC_PROFILE_AAC_LC: number;
64
+ var NMC_PROFILE_AAC_HE: number;
65
+ var NMC_PROFILE_AAC_HE_V2: number;
66
+ var VIDEO_ORIENTATION_PORTRAIT: number;
67
+ var VIDEO_ORIENTATION_LANDSCAPE_RIGHT: number;
68
+ var VIDEO_ORIENTATION_LANDSCAPE_LEFT: number;
69
+ var FLAG_AF: number;
70
+ var FLAG_AE: number;
71
+ var FLAG_AWB: number;
72
+ var NMC_DEVICE_TYPE_WideAngleCamera: number;
73
+ var NMC_DEVICE_TYPE_TelephotoCamera: number;
74
+ var NMC_DEVICE_TYPE_UltraWideCamera: number;
75
+ var NMC_DEVICE_TYPE_DualCamera: number;
76
+ var NMC_DEVICE_TYPE_TripleCamera: number;
77
+ var EFFECTOR_BRIGHTNESS: string;
78
+ var EFFECTOR_CONTRAST: string;
79
+ var EFFECTOR_SATURATION: string;
80
+ var EFFECTOR_SHARPEN: string;
81
+ var EFFECTOR_SMOOTHSKIN: string;
82
+ var EFFECTOR_STYLE: string;
83
+ var EFFECTOR_STYLE_ID_ORIGINAL: number;
84
+ var EFFECTOR_STYLE_ID_ENHANCED: number;
85
+ var EFFECTOR_STYLE_ID_FAIRSKIN: number;
86
+ var EFFECTOR_STYLE_ID_COOL: number;
87
+ var EFFECTOR_STYLE_ID_FILM: number;
88
+ var EFFECTOR_STYLE_ID_BOOST: number;
89
+ }
90
+ export default ExpoNodePublisherView;
91
+ //# sourceMappingURL=ExpoNodePublisherView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoNodePublisherView.d.ts","sourceRoot":"","sources":["../src/ExpoNodePublisherView.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,CAAC,GAAG,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,kBAAkB,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAClE,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,2BAA2B,EAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACjD,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb,CAAA;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAA;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,GAAG,CAAC,EAAE,gBAAgB,CAAC;IACvB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,WAAW,EAAE,0BAA0B,CAAA;KAAE,KAAK,IAAI,CAAC;CAChF,GAAG,SAAS,CAAC;AAGd,iBAAS,qBAAqB,CAAC,KAAK,EAAE,kBAAkB,+BAEvD;kBAFQ,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0C9B,eAAe,qBAAqB,CAAC"}
@@ -0,0 +1,44 @@
1
+ import { requireNativeViewManager } from 'expo-modules-core';
2
+ const NativeView = requireNativeViewManager('ExpoNodePublisherView');
3
+ function ExpoNodePublisherView(props) {
4
+ return <NativeView {...props}/>;
5
+ }
6
+ ExpoNodePublisherView.NMC_CODEC_ID_H264 = 27;
7
+ ExpoNodePublisherView.NMC_CODEC_ID_H265 = 173;
8
+ ExpoNodePublisherView.NMC_CODEC_ID_AAC = 86018;
9
+ ExpoNodePublisherView.NMC_CODEC_ID_OPUS = 86076;
10
+ ExpoNodePublisherView.NMC_CODEC_ID_PCMA = 65543;
11
+ ExpoNodePublisherView.NMC_CODEC_ID_PCMU = 65542;
12
+ ExpoNodePublisherView.NMC_PROFILE_AUTO = 0;
13
+ ExpoNodePublisherView.NMC_PROFILE_H264_BASELINE = 66;
14
+ ExpoNodePublisherView.NMC_PROFILE_H264_MAIN = 77;
15
+ ExpoNodePublisherView.NMC_PROFILE_H264_HIGH = 100;
16
+ ExpoNodePublisherView.NMC_PROFILE_H265_MAIN = 1;
17
+ ExpoNodePublisherView.NMC_PROFILE_AAC_LC = 1;
18
+ ExpoNodePublisherView.NMC_PROFILE_AAC_HE = 4;
19
+ ExpoNodePublisherView.NMC_PROFILE_AAC_HE_V2 = 28;
20
+ ExpoNodePublisherView.VIDEO_ORIENTATION_PORTRAIT = 1;
21
+ ExpoNodePublisherView.VIDEO_ORIENTATION_LANDSCAPE_RIGHT = 3;
22
+ ExpoNodePublisherView.VIDEO_ORIENTATION_LANDSCAPE_LEFT = 4;
23
+ ExpoNodePublisherView.FLAG_AF = 1;
24
+ ExpoNodePublisherView.FLAG_AE = 2;
25
+ ExpoNodePublisherView.FLAG_AWB = 4;
26
+ ExpoNodePublisherView.NMC_DEVICE_TYPE_WideAngleCamera = 0;
27
+ ExpoNodePublisherView.NMC_DEVICE_TYPE_TelephotoCamera = 1;
28
+ ExpoNodePublisherView.NMC_DEVICE_TYPE_UltraWideCamera = 2;
29
+ ExpoNodePublisherView.NMC_DEVICE_TYPE_DualCamera = 3;
30
+ ExpoNodePublisherView.NMC_DEVICE_TYPE_TripleCamera = 4;
31
+ ExpoNodePublisherView.EFFECTOR_BRIGHTNESS = "brightness";
32
+ ExpoNodePublisherView.EFFECTOR_CONTRAST = "contrast";
33
+ ExpoNodePublisherView.EFFECTOR_SATURATION = "saturation";
34
+ ExpoNodePublisherView.EFFECTOR_SHARPEN = "sharpen";
35
+ ExpoNodePublisherView.EFFECTOR_SMOOTHSKIN = "smoothskin";
36
+ ExpoNodePublisherView.EFFECTOR_STYLE = "style";
37
+ ExpoNodePublisherView.EFFECTOR_STYLE_ID_ORIGINAL = 0;
38
+ ExpoNodePublisherView.EFFECTOR_STYLE_ID_ENHANCED = 1;
39
+ ExpoNodePublisherView.EFFECTOR_STYLE_ID_FAIRSKIN = 2;
40
+ ExpoNodePublisherView.EFFECTOR_STYLE_ID_COOL = 3;
41
+ ExpoNodePublisherView.EFFECTOR_STYLE_ID_FILM = 4;
42
+ ExpoNodePublisherView.EFFECTOR_STYLE_ID_BOOST = 5;
43
+ export default ExpoNodePublisherView;
44
+ //# sourceMappingURL=ExpoNodePublisherView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoNodePublisherView.js","sourceRoot":"","sources":["../src/ExpoNodePublisherView.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAqD7D,MAAM,UAAU,GAA4C,wBAAwB,CAAC,uBAAuB,CAAC,CAAC;AAC9G,SAAS,qBAAqB,CAAC,KAAyB;IACtD,OAAO,CAAC,UAAU,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AACnC,CAAC;AAED,qBAAqB,CAAC,iBAAiB,GAAG,EAAE,CAAC;AAC7C,qBAAqB,CAAC,iBAAiB,GAAG,GAAG,CAAC;AAC9C,qBAAqB,CAAC,gBAAgB,GAAG,KAAK,CAAC;AAC/C,qBAAqB,CAAC,iBAAiB,GAAG,KAAK,CAAC;AAChD,qBAAqB,CAAC,iBAAiB,GAAG,KAAK,CAAC;AAChD,qBAAqB,CAAC,iBAAiB,GAAG,KAAK,CAAC;AAChD,qBAAqB,CAAC,gBAAgB,GAAG,CAAC,CAAC;AAC3C,qBAAqB,CAAC,yBAAyB,GAAG,EAAE,CAAC;AACrD,qBAAqB,CAAC,qBAAqB,GAAG,EAAE,CAAC;AACjD,qBAAqB,CAAC,qBAAqB,GAAG,GAAG,CAAC;AAClD,qBAAqB,CAAC,qBAAqB,GAAG,CAAC,CAAC;AAChD,qBAAqB,CAAC,kBAAkB,GAAG,CAAC,CAAC;AAC7C,qBAAqB,CAAC,kBAAkB,GAAG,CAAC,CAAC;AAC7C,qBAAqB,CAAC,qBAAqB,GAAG,EAAE,CAAC;AACjD,qBAAqB,CAAC,0BAA0B,GAAG,CAAC,CAAC;AACrD,qBAAqB,CAAC,iCAAiC,GAAG,CAAC,CAAC;AAC5D,qBAAqB,CAAC,gCAAgC,GAAG,CAAC,CAAC;AAC3D,qBAAqB,CAAC,OAAO,GAAG,CAAC,CAAC;AAClC,qBAAqB,CAAC,OAAO,GAAG,CAAC,CAAC;AAClC,qBAAqB,CAAC,QAAQ,GAAG,CAAC,CAAC;AACnC,qBAAqB,CAAC,+BAA+B,GAAG,CAAC,CAAC;AAC1D,qBAAqB,CAAC,+BAA+B,GAAG,CAAC,CAAC;AAC1D,qBAAqB,CAAC,+BAA+B,GAAG,CAAC,CAAC;AAC1D,qBAAqB,CAAC,0BAA0B,GAAG,CAAC,CAAC;AACrD,qBAAqB,CAAC,4BAA4B,GAAG,CAAC,CAAC;AACvD,qBAAqB,CAAC,mBAAmB,GAAG,YAAY,CAAC;AACzD,qBAAqB,CAAC,iBAAiB,GAAG,UAAU,CAAC;AACrD,qBAAqB,CAAC,mBAAmB,GAAG,YAAY,CAAC;AACzD,qBAAqB,CAAC,gBAAgB,GAAG,SAAS,CAAC;AACnD,qBAAqB,CAAC,mBAAmB,GAAG,YAAY,CAAC;AACzD,qBAAqB,CAAC,cAAc,GAAG,OAAO,CAAC;AAC/C,qBAAqB,CAAC,0BAA0B,GAAG,CAAC,CAAC;AACrD,qBAAqB,CAAC,0BAA0B,GAAG,CAAC,CAAC;AACrD,qBAAqB,CAAC,0BAA0B,GAAG,CAAC,CAAC;AACrD,qBAAqB,CAAC,sBAAsB,GAAG,CAAC,CAAC;AACjD,qBAAqB,CAAC,sBAAsB,GAAG,CAAC,CAAC;AACjD,qBAAqB,CAAC,uBAAuB,GAAG,CAAC,CAAC;AAElD,eAAe,qBAAqB,CAAC","sourcesContent":["\nimport { ViewProps } from 'react-native';\nimport { requireNativeViewManager } from 'expo-modules-core';\n\nexport type NodePublisherRef = {\n start: (url?: string) => Promise<void>;\n stop: () => Promise<void>;\n setEffectParameter: (key: string, value: number) => Promise<void>;\n setEffectStyle: (style: number) => Promise<void>;\n startFocusAndMeteringCenter:() => Promise<void>;\n}\n\nexport type NodePublisherEventCallback = {\n event: number;\n msg: string;\n}\n\nexport type AudioParam = {\n codecid?: number;\n profile?: number;\n samplingRate?: number;\n channels?: number;\n bitrate?: number;\n}\n\nexport type VideoParam = {\n codecid?: number;\n profile?: number;\n width?: number;\n height?: number;\n fps?: number;\n bitrate?: number;\n}\n\nexport type NodePublisherProps = {\n ref?: NodePublisherRef;\n url?: string;\n cryptoKey?: string;\n audioParam?: AudioParam\n videoParam?: VideoParam;\n keyFrameInterval?: number;\n videoOrientation?: number;\n frontCamera?: boolean;\n cameraFrontMirror?: boolean;\n zoomRatio?: number;\n volume?: number;\n torchEnable?: boolean;\n HWAccelEnable?: boolean;\n denoiseEnable?: boolean;\n colorStyleId?: number;\n colorStyleIntensity?: number;\n smoothskinIntensity?: number;\n onEventCallback?: (event: { nativeEvent: NodePublisherEventCallback }) => void;\n} & ViewProps;\n\nconst NativeView: React.ComponentType<NodePublisherProps> = requireNativeViewManager('ExpoNodePublisherView');\nfunction ExpoNodePublisherView(props: NodePublisherProps) {\n return <NativeView {...props} />;\n}\n\nExpoNodePublisherView.NMC_CODEC_ID_H264 = 27;\nExpoNodePublisherView.NMC_CODEC_ID_H265 = 173;\nExpoNodePublisherView.NMC_CODEC_ID_AAC = 86018;\nExpoNodePublisherView.NMC_CODEC_ID_OPUS = 86076;\nExpoNodePublisherView.NMC_CODEC_ID_PCMA = 65543;\nExpoNodePublisherView.NMC_CODEC_ID_PCMU = 65542;\nExpoNodePublisherView.NMC_PROFILE_AUTO = 0;\nExpoNodePublisherView.NMC_PROFILE_H264_BASELINE = 66;\nExpoNodePublisherView.NMC_PROFILE_H264_MAIN = 77;\nExpoNodePublisherView.NMC_PROFILE_H264_HIGH = 100;\nExpoNodePublisherView.NMC_PROFILE_H265_MAIN = 1;\nExpoNodePublisherView.NMC_PROFILE_AAC_LC = 1;\nExpoNodePublisherView.NMC_PROFILE_AAC_HE = 4;\nExpoNodePublisherView.NMC_PROFILE_AAC_HE_V2 = 28;\nExpoNodePublisherView.VIDEO_ORIENTATION_PORTRAIT = 1;\nExpoNodePublisherView.VIDEO_ORIENTATION_LANDSCAPE_RIGHT = 3;\nExpoNodePublisherView.VIDEO_ORIENTATION_LANDSCAPE_LEFT = 4;\nExpoNodePublisherView.FLAG_AF = 1;\nExpoNodePublisherView.FLAG_AE = 2;\nExpoNodePublisherView.FLAG_AWB = 4;\nExpoNodePublisherView.NMC_DEVICE_TYPE_WideAngleCamera = 0;\nExpoNodePublisherView.NMC_DEVICE_TYPE_TelephotoCamera = 1;\nExpoNodePublisherView.NMC_DEVICE_TYPE_UltraWideCamera = 2;\nExpoNodePublisherView.NMC_DEVICE_TYPE_DualCamera = 3;\nExpoNodePublisherView.NMC_DEVICE_TYPE_TripleCamera = 4;\nExpoNodePublisherView.EFFECTOR_BRIGHTNESS = \"brightness\";\nExpoNodePublisherView.EFFECTOR_CONTRAST = \"contrast\";\nExpoNodePublisherView.EFFECTOR_SATURATION = \"saturation\";\nExpoNodePublisherView.EFFECTOR_SHARPEN = \"sharpen\";\nExpoNodePublisherView.EFFECTOR_SMOOTHSKIN = \"smoothskin\";\nExpoNodePublisherView.EFFECTOR_STYLE = \"style\";\nExpoNodePublisherView.EFFECTOR_STYLE_ID_ORIGINAL = 0;\nExpoNodePublisherView.EFFECTOR_STYLE_ID_ENHANCED = 1;\nExpoNodePublisherView.EFFECTOR_STYLE_ID_FAIRSKIN = 2;\nExpoNodePublisherView.EFFECTOR_STYLE_ID_COOL = 3;\nExpoNodePublisherView.EFFECTOR_STYLE_ID_FILM = 4;\nExpoNodePublisherView.EFFECTOR_STYLE_ID_BOOST = 5;\n\nexport default ExpoNodePublisherView;"]}
package/build/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export { default as NodeMediaClient } from './ExpoNodeMediaClientModule';
2
- export { default as NodePlayer, NodePlayerRef, NodePlayerProps } from './ExpoNodePlayerView';
2
+ export { default as NodePlayer, NodePlayerRef, NodePlayerProps, NodePlayerEventCallback } from './ExpoNodePlayerView';
3
+ export { default as NodePublisher, AudioParam, VideoParam, NodePublisherRef, NodePublisherProps, NodePublisherEventCallback } from './ExpoNodePublisherView';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACtH,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC"}
package/build/index.js CHANGED
@@ -1,8 +1,6 @@
1
- //
2
- // Copyright (c) 2025 NodeMedia Technology Co., Ltd.
3
- // Created by Chen Mingliang on 2025-07-22.
4
- // All rights reserved.
5
- //
1
+ // Reexport the native module. On web, it will be resolved to ExpoNodemediaclientModule.web.ts
2
+ // and on native platforms to ExpoNodemediaclientModule.ts
6
3
  export { default as NodeMediaClient } from './ExpoNodeMediaClientModule';
7
4
  export { default as NodePlayer } from './ExpoNodePlayerView';
5
+ export { default as NodePublisher } from './ExpoNodePublisherView';
8
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,qDAAqD;AACrD,4CAA4C;AAC5C,wBAAwB;AACxB,EAAE;AAEF,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAkC,MAAM,sBAAsB,CAAC","sourcesContent":["//\n// Copyright (c) 2025 NodeMedia Technology Co., Ltd.\n// Created by Chen Mingliang on 2025-07-22.\n// All rights reserved.\n//\n\nexport { default as NodeMediaClient } from './ExpoNodeMediaClientModule';\nexport { default as NodePlayer, NodePlayerRef, NodePlayerProps } from './ExpoNodePlayerView';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,0DAA0D;AAC1D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,UAAU,EAA2D,MAAM,sBAAsB,CAAC;AACtH,OAAO,EAAE,OAAO,IAAI,aAAa,EAA4F,MAAM,yBAAyB,CAAC","sourcesContent":["// Reexport the native module. On web, it will be resolved to ExpoNodemediaclientModule.web.ts\n// and on native platforms to ExpoNodemediaclientModule.ts\nexport { default as NodeMediaClient } from './ExpoNodeMediaClientModule';\nexport { default as NodePlayer, NodePlayerRef, NodePlayerProps, NodePlayerEventCallback } from './ExpoNodePlayerView';\nexport { default as NodePublisher, AudioParam, VideoParam, NodePublisherRef, NodePublisherProps, NodePublisherEventCallback } from './ExpoNodePublisherView';"]}
@@ -3,13 +3,15 @@
3
3
  "apple": {
4
4
  "modules": [
5
5
  "ExpoNodeMediaClientModule",
6
- "ExpoNodePlayerModule"
6
+ "ExpoNodePlayerViewModule",
7
+ "ExpoNodePublisherViewModule"
7
8
  ]
8
9
  },
9
10
  "android": {
10
11
  "modules": [
11
12
  "expo.modules.nodemediaclient.ExpoNodeMediaClientModule",
12
- "expo.modules.nodemediaclient.ExpoNodePlayerModule"
13
+ "expo.modules.nodemediaclient.ExpoNodePlayerViewModule",
14
+ "expo.modules.nodemediaclient.ExpoNodePublisherViewModule"
13
15
  ]
14
16
  }
15
17
  }
@@ -24,4 +24,4 @@ public class ExpoNodeMediaClientModule: Module {
24
24
  }
25
25
 
26
26
  }
27
- }
27
+ }
@@ -7,82 +7,88 @@
7
7
  import ExpoModulesCore
8
8
  import NodeMediaClient
9
9
 
10
- class ExpoNodePlayerView: ExpoView {
11
- private var _np: NodePlayer?
12
- var url = ""
13
- var croptyKey = ""
14
- var HTTPReferer = ""
15
- var HTTPUserAgent = ""
16
- var RTSPTransport = "udp"
17
- var HWAccelEnable = true
18
- private var _volume:Float = 1.0
19
- private var _scaleMode: UInt = 0
20
- private var _bufferTime: UInt = 1000
21
-
10
+ class ExpoNodePlayerView: ExpoView, NodePlayerDelegate {
11
+ private var _np: NodePlayer?
12
+ var url = ""
13
+ var croptyKey = ""
14
+ var HTTPReferer = ""
15
+ var HTTPUserAgent = ""
16
+ var RTSPTransport = "udp"
17
+ var HWAccelEnable = true
18
+ private var _volume: Float = 1.0
19
+ private var _scaleMode: Int = 0
20
+ private var _bufferTime: Int = 1000
22
21
 
23
- var volume:Float {
24
- get {
25
- return _volume
22
+ // EventDispatcher for sending events to JavaScript
23
+ var onEventCallback = EventDispatcher()
24
+
25
+ var volume:Float {
26
+ get {
27
+ return _volume
28
+ }
29
+ set {
30
+ _volume = newValue
31
+ _np?.volume = newValue
32
+ }
26
33
  }
27
- set {
28
- _volume = newValue
29
- _np?.volume = newValue
34
+
35
+ var scaleMode:Int {
36
+ get {
37
+ return _scaleMode
38
+ }
39
+ set {
40
+ _scaleMode = newValue
41
+ _np?.scaleMode = newValue
42
+ }
30
43
  }
31
- }
32
-
33
- var scaleMode:UInt {
34
- get {
35
- return _scaleMode
44
+
45
+ var bufferTime:Int {
46
+ get {
47
+ return _bufferTime
48
+ }
49
+ set {
50
+ _bufferTime = newValue
51
+ _np?.bufferTime = newValue
52
+ }
36
53
  }
37
- set {
38
- _scaleMode = newValue
39
- _np?.scaleMode = newValue
54
+
55
+ required init(appContext: AppContext? = nil) {
56
+ super.init(appContext: appContext)
57
+ _np = NodePlayer(license: LICENSE_KEY)
58
+ _np?.nodePlayerDelegate = self
59
+ _np?.attach(self)
40
60
  }
41
- }
42
-
43
- var bufferTime:UInt {
44
- get {
45
- return _bufferTime
61
+
62
+ deinit {
63
+ _np?.stop()
64
+ _np?.detachView()
65
+ _np = nil
46
66
  }
47
- set {
48
- _bufferTime = newValue
49
- _np?.bufferTime = newValue
67
+
68
+ func start(u: String?) {
69
+ if let newUrl = u {
70
+ url = newUrl
71
+ }
72
+ _np?.volume = volume
73
+ _np?.cryptoKey = croptyKey
74
+ _np?.scaleMode = scaleMode
75
+ _np?.bufferTime = bufferTime
76
+ _np?.httpReferer = HTTPReferer
77
+ _np?.httpUserAgent = HTTPUserAgent
78
+ _np?.rtspTransport = RTSPTransport
79
+ _np?.hwAccelEnable = HWAccelEnable
80
+ _np?.start(url)
50
81
  }
51
- }
52
-
53
- required init(appContext: AppContext? = nil) {
54
- super.init(appContext: appContext)
55
- _np = NodePlayer(license: LICENSE_KEY)
56
- _np?.attach(self)
57
- }
58
-
59
- deinit {
60
- _np?.stop()
61
- _np?.detachView()
62
- _np = nil
63
- }
64
-
65
- func start(u: String?) {
66
- if let newUrl = u {
67
- url = newUrl
82
+
83
+ func stop() {
84
+ _np?.stop()
68
85
  }
69
- _np?.volume = volume
70
- _np?.cryptoKey = croptyKey
71
- _np?.scaleMode = scaleMode
72
- _np?.bufferTime = bufferTime
73
- _np?.httpReferer = HTTPReferer
74
- _np?.httpUserAgent = HTTPUserAgent
75
- _np?.rtspTransport = RTSPTransport
76
- _np?.hwAccelEnable = HWAccelEnable
77
- _np?.start(url)
78
- }
79
-
80
- func stop() {
81
- _np?.stop()
82
- }
83
-
84
- override func layoutSubviews() {
85
- // webView.frame = bounds
86
- }
86
+
87
+ func onEventCallback(_ sender: Any, event: Int32, msg: String) {
88
+ onEventCallback([
89
+ "event": Int(event),
90
+ "msg": msg
91
+ ])
92
+ }
93
+
87
94
  }
88
-
@@ -6,7 +6,7 @@
6
6
 
7
7
  import ExpoModulesCore
8
8
 
9
- public class ExpoNodePlayerModule: Module {
9
+ public class ExpoNodePlayerViewModule: Module {
10
10
  // Each module class must implement the definition function. The definition consists of components
11
11
  // that describes the module's functionality and behavior.
12
12
  // See https://docs.expo.dev/modules/module-api for more details about available components.
@@ -17,6 +17,8 @@ public class ExpoNodePlayerModule: Module {
17
17
  Name("ExpoNodePlayerView")
18
18
 
19
19
  View(ExpoNodePlayerView.self) {
20
+ Events("onEventCallback")
21
+
20
22
  Prop("url") { (view, url: String) in
21
23
  view.url = url
22
24
  }
@@ -26,10 +28,10 @@ public class ExpoNodePlayerModule: Module {
26
28
  Prop("croptyKey") { (view, key: String) in
27
29
  view.croptyKey = key
28
30
  }
29
- Prop("scaleMode") { (view, mode: UInt) in
31
+ Prop("scaleMode") { (view, mode: Int) in
30
32
  view.scaleMode = mode
31
33
  }
32
- Prop("bufferTime") { (view, time: UInt) in
34
+ Prop("bufferTime") { (view, time: Int) in
33
35
  view.bufferTime = time
34
36
  }
35
37
  Prop("HTTPReferer") { (view, referer: String) in
@@ -44,15 +46,15 @@ public class ExpoNodePlayerModule: Module {
44
46
  Prop("HWAccelEnable") { (view, enable: Bool) in
45
47
  view.HWAccelEnable = enable
46
48
  }
47
-
49
+
48
50
  AsyncFunction("start") { (view: ExpoNodePlayerView, url: String?) in
49
51
  view.start(u:url)
50
52
  }
51
-
53
+
52
54
  AsyncFunction("stop") { (view: ExpoNodePlayerView) in
53
55
  view.stop()
54
56
  }
55
57
  }
56
58
 
57
59
  }
58
- }
60
+ }