blix-expo-settings 0.1.0 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/ExpoSettingsModule.d.ts.map +1 -1
- package/build/ExpoSettingsModule.js +1 -1
- package/build/ExpoSettingsModule.js.map +1 -1
- package/build/ExpoSettingsView.js.map +1 -1
- package/build/index.d.ts +3 -3
- package/build/index.d.ts.map +1 -1
- package/build/index.js +2 -2
- package/build/index.js.map +1 -1
- package/ios/ExpoSettings.podspec +1 -1
- package/ios/ExpoSettingsModule.swift +28 -13
- package/package.json +2 -3
- package/src/ExpoSettingsModule.ts +2 -2
- package/src/ExpoSettingsView.tsx +1 -1
- package/src/index.ts +14 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoSettingsModule.d.ts","sourceRoot":"","sources":["../src/ExpoSettingsModule.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ExpoSettingsModule.d.ts","sourceRoot":"","sources":["../src/ExpoSettingsModule.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,kBAAkB,KAQnB,CAAC;AAEN,eAAe,kBAAkB,CAAC"}
|
|
@@ -6,9 +6,9 @@ const ExpoSettingsModule = Platform.OS === 'ios'
|
|
|
6
6
|
: {
|
|
7
7
|
// Métodos usados pelo seu fluxo de live-stream
|
|
8
8
|
initializePreview: () => Promise.resolve(), // se for async, senão só () => {}
|
|
9
|
-
startStream: (_url, _streamKey) => { },
|
|
10
9
|
publishStream: (_url, _streamKey) => { },
|
|
11
10
|
stopStream: () => { },
|
|
11
|
+
getStreamStatus: () => Promise.resolve('stopped'),
|
|
12
12
|
};
|
|
13
13
|
export default ExpoSettingsModule;
|
|
14
14
|
//# sourceMappingURL=ExpoSettingsModule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoSettingsModule.js","sourceRoot":"","sources":["../src/ExpoSettingsModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"ExpoSettingsModule.js","sourceRoot":"","sources":["../src/ExpoSettingsModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAGxD,sEAAsE;AACtE,MAAM,kBAAkB,GAAG,QAAQ,CAAC,EAAE,KAAK,KAAK;IAC9C,CAAC,CAAC,mBAAmB,CAAC,cAAc,CAAC;IACrC,CAAC,CAAC;QACE,+CAA+C;QAC/C,iBAAiB,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,EAAG,kCAAkC;QAC/E,aAAa,EAAE,CAAC,IAAY,EAAE,UAAkB,EAAE,EAAE,GAAE,CAAC;QACvD,UAAU,EAAE,GAAG,EAAE,GAAE,CAAC;QACpB,eAAe,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC;KAClD,CAAC;AAEN,eAAe,kBAAkB,CAAC","sourcesContent":["import { Platform } from 'react-native';\nimport { requireNativeModule } from 'expo-modules-core';\n\n\n// Só carrega o native module no iOS; no Android, exporta stubs vazios\nconst ExpoSettingsModule = Platform.OS === 'ios'\n ? requireNativeModule('ExpoSettings')\n : {\n // Métodos usados pelo seu fluxo de live-stream\n initializePreview: () => Promise.resolve(), // se for async, senão só () => {}\n publishStream: (_url: string, _streamKey: string) => {},\n stopStream: () => {},\n getStreamStatus: () => Promise.resolve('stopped'),\n };\n\nexport default ExpoSettingsModule;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoSettingsView.js","sourceRoot":"","sources":["../src/ExpoSettingsView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,MAAM,UAAU,GACd,wBAAwB,CAAC,cAAc,CAAC,CAAC;AAEzC,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,KAA4B;IACnE,OAAO,CAAC,UAAU,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AACnC,CAAC","sourcesContent":["import { requireNativeViewManager } from \"expo-modules-core\";\nimport * as React from \"react\";\nimport {\n ExpoSettingsViewProps,\n} from \"./ExpoSettings.types\";\n\nconst NativeView: React.ComponentType<ExpoSettingsViewProps> =\n requireNativeViewManager(\"ExpoSettings\");\n\n export default function ExpoSettingsView(props: ExpoSettingsViewProps) {\n return <NativeView {...props} />;\n }
|
|
1
|
+
{"version":3,"file":"ExpoSettingsView.js","sourceRoot":"","sources":["../src/ExpoSettingsView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,MAAM,UAAU,GACd,wBAAwB,CAAC,cAAc,CAAC,CAAC;AAEzC,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,KAA4B;IACnE,OAAO,CAAC,UAAU,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AACnC,CAAC","sourcesContent":["import { requireNativeViewManager } from \"expo-modules-core\";\nimport * as React from \"react\";\nimport {\n ExpoSettingsViewProps,\n} from \"./ExpoSettings.types\";\n\nconst NativeView: React.ComponentType<ExpoSettingsViewProps> =\n requireNativeViewManager(\"ExpoSettings\");\n\n export default function ExpoSettingsView(props: ExpoSettingsViewProps) {\n return <NativeView {...props} />;\n }"]}
|
package/build/index.d.ts
CHANGED
|
@@ -2,11 +2,11 @@ import { Subscription } from "expo-modules-core";
|
|
|
2
2
|
import ExpoSettingsView from './ExpoSettingsView';
|
|
3
3
|
export { ExpoSettingsView };
|
|
4
4
|
export type LiveChangeEvent = {
|
|
5
|
-
status: "
|
|
5
|
+
status: "previewInitializing" | "previewReady" | "connecting" | "connected" | "publishing" | "started" | "stopped";
|
|
6
6
|
};
|
|
7
7
|
export declare function addLiveListener(listener: (event: LiveChangeEvent) => void): Subscription;
|
|
8
8
|
export declare function initializePreview(): void;
|
|
9
|
-
export declare function publishStream(url:
|
|
9
|
+
export declare function publishStream(url: string, streamKey: string): void;
|
|
10
10
|
export declare function stopStream(): void;
|
|
11
|
-
export declare function
|
|
11
|
+
export declare function getStreamStatus(): Promise<string>;
|
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE/D,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAIlD,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAE5B,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE/D,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAIlD,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAE5B,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EACJ,qBAAqB,GACrB,cAAc,GACd,YAAY,GACZ,WAAW,GACX,YAAY,GACZ,SAAS,GACT,SAAS,CAAC;CACb,CAAC;AAEF,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,GACzC,YAAY,CAEd;AAED,wBAAgB,iBAAiB,IAAI,IAAI,CAExC;AAGD,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAElE;AAED,wBAAgB,UAAU,IAAI,IAAI,CAEjC;AAED,wBAAsB,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC,CAEvD"}
|
package/build/index.js
CHANGED
|
@@ -16,7 +16,7 @@ export function publishStream(url, streamKey) {
|
|
|
16
16
|
export function stopStream() {
|
|
17
17
|
return ExpoSettingsModule.stopStream();
|
|
18
18
|
}
|
|
19
|
-
export function
|
|
20
|
-
return ExpoSettingsModule.
|
|
19
|
+
export async function getStreamStatus() {
|
|
20
|
+
return await ExpoSettingsModule.getStreamStatus();
|
|
21
21
|
}
|
|
22
22
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAgB,MAAM,mBAAmB,CAAC;AAC/D,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAElD,MAAM,OAAO,GAAG,IAAI,YAAY,CAAC,kBAAkB,CAAC,CAAC;AAErD,OAAO,EAAE,gBAAgB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAgB,MAAM,mBAAmB,CAAC;AAC/D,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAElD,MAAM,OAAO,GAAG,IAAI,YAAY,CAAC,kBAAkB,CAAC,CAAC;AAErD,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAa5B,MAAM,UAAU,eAAe,CAC7B,QAA0C;IAE1C,OAAO,OAAO,CAAC,WAAW,CAAkB,gBAAgB,EAAE,QAAQ,CAAC,CAAC;AAC1E,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,OAAO,kBAAkB,CAAC,iBAAiB,EAAE,CAAC;AAChD,CAAC;AAED,4DAA4D;AAC5D,MAAM,UAAU,aAAa,CAAC,GAAW,EAAE,SAAiB;IAC1D,OAAO,kBAAkB,CAAC,aAAa,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;AAC1D,CAAC;AAED,MAAM,UAAU,UAAU;IACxB,OAAO,kBAAkB,CAAC,UAAU,EAAE,CAAC;AACzC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe;IACnC,OAAO,MAAM,kBAAkB,CAAC,eAAe,EAAE,CAAC;AACpD,CAAC","sourcesContent":["import { EventEmitter, Subscription } from \"expo-modules-core\";\nimport ExpoSettingsModule from \"./ExpoSettingsModule\";\nimport ExpoSettingsView from './ExpoSettingsView';\n\nconst emitter = new EventEmitter(ExpoSettingsModule);\n\nexport { ExpoSettingsView };\n\nexport type LiveChangeEvent = {\n status:\n | \"previewInitializing\"\n | \"previewReady\"\n | \"connecting\"\n | \"connected\"\n | \"publishing\"\n | \"started\"\n | \"stopped\";\n};\n\nexport function addLiveListener(\n listener: (event: LiveChangeEvent) => void\n): Subscription {\n return emitter.addListener<LiveChangeEvent>(\"onStreamStatus\", listener);\n}\n\nexport function initializePreview(): void {\n return ExpoSettingsModule.initializePreview();\n}\n\n// ← RENOMEADO startStream → publishStream, agora só publica\nexport function publishStream(url: string, streamKey: string): void {\n return ExpoSettingsModule.publishStream(url, streamKey);\n}\n\nexport function stopStream(): void {\n return ExpoSettingsModule.stopStream();\n}\n\nexport async function getStreamStatus(): Promise<string> {\n return await ExpoSettingsModule.getStreamStatus();\n}"]}
|
package/ios/ExpoSettings.podspec
CHANGED
|
@@ -6,6 +6,8 @@ import VideoToolbox
|
|
|
6
6
|
public class ExpoSettingsModule: Module {
|
|
7
7
|
private var rtmpConnection: RTMPConnection?
|
|
8
8
|
private var rtmpStream: RTMPStream?
|
|
9
|
+
private var currentStreamStatus: String = "stopped"
|
|
10
|
+
|
|
9
11
|
|
|
10
12
|
public func definition() -> ModuleDefinition {
|
|
11
13
|
Name("ExpoSettings")
|
|
@@ -18,9 +20,14 @@ public class ExpoSettingsModule: Module {
|
|
|
18
20
|
|
|
19
21
|
Events("onStreamStatus")
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
Function("getStreamStatus") {
|
|
24
|
+
return self.currentStreamStatus
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
Function("initializePreview") { () -> Void in
|
|
22
28
|
Task {
|
|
23
|
-
|
|
29
|
+
self.currentStreamStatus = "previewInitializing"
|
|
30
|
+
sendEvent("onStreamStatus", ["status": self.currentStreamStatus])
|
|
24
31
|
|
|
25
32
|
do {
|
|
26
33
|
|
|
@@ -91,9 +98,9 @@ public class ExpoSettingsModule: Module {
|
|
|
91
98
|
stream.audioSettings = audioSettings
|
|
92
99
|
|
|
93
100
|
let videoSettings = VideoCodecSettings(
|
|
94
|
-
videoSize: .init(width:
|
|
95
|
-
bitRate:
|
|
96
|
-
profileLevel:
|
|
101
|
+
videoSize: .init(width: 1080, height: 1920),
|
|
102
|
+
bitRate: 4000 * 1000,
|
|
103
|
+
profileLevel: kVTProfileLevel_H264_Baseline_4_0 as String,
|
|
97
104
|
scalingMode: .trim,
|
|
98
105
|
bitRateMode: .average,
|
|
99
106
|
maxKeyFrameIntervalDuration: 2,
|
|
@@ -102,7 +109,8 @@ public class ExpoSettingsModule: Module {
|
|
|
102
109
|
)
|
|
103
110
|
stream.videoSettings = videoSettings
|
|
104
111
|
}
|
|
105
|
-
|
|
112
|
+
self.currentStreamStatus = "previewReady"
|
|
113
|
+
sendEvent("onStreamStatus", ["status": self.currentStreamStatus])
|
|
106
114
|
}
|
|
107
115
|
}
|
|
108
116
|
|
|
@@ -111,7 +119,8 @@ public class ExpoSettingsModule: Module {
|
|
|
111
119
|
|
|
112
120
|
print("[ExpoSettings] Publishing stream to URL: \(url) with key: \(streamKey)")
|
|
113
121
|
|
|
114
|
-
|
|
122
|
+
self.currentStreamStatus = "connecting"
|
|
123
|
+
sendEvent("onStreamStatus", ["status": self.currentStreamStatus])
|
|
115
124
|
|
|
116
125
|
// se não houve initializePreview→recria a connection
|
|
117
126
|
if self.rtmpConnection == nil || self.rtmpStream == nil {
|
|
@@ -135,17 +144,21 @@ public class ExpoSettingsModule: Module {
|
|
|
135
144
|
// Use existing connection
|
|
136
145
|
self.rtmpConnection?.connect(url)
|
|
137
146
|
}
|
|
138
|
-
|
|
139
|
-
sendEvent("onStreamStatus", ["status":
|
|
147
|
+
self.currentStreamStatus = "connected"
|
|
148
|
+
sendEvent("onStreamStatus", ["status": self.currentStreamStatus])
|
|
149
|
+
|
|
150
|
+
self.currentStreamStatus = "publishing"
|
|
151
|
+
sendEvent("onStreamStatus", ["status": self.currentStreamStatus])
|
|
140
152
|
|
|
141
|
-
sendEvent("onStreamStatus", ["status": "publishing"])
|
|
142
153
|
self.rtmpStream?.publish(streamKey)
|
|
143
154
|
print("[ExpoSettings] Stream published successfully")
|
|
144
|
-
|
|
155
|
+
|
|
156
|
+
self.currentStreamStatus = "started"
|
|
157
|
+
sendEvent("onStreamStatus", ["status": self.currentStreamStatus])
|
|
145
158
|
}
|
|
146
159
|
}
|
|
147
160
|
|
|
148
|
-
|
|
161
|
+
Function("stopStream") { () -> Void in
|
|
149
162
|
Task {
|
|
150
163
|
print("[ExpoSettings] stopStream called")
|
|
151
164
|
|
|
@@ -170,7 +183,9 @@ public class ExpoSettingsModule: Module {
|
|
|
170
183
|
self.rtmpConnection = nil
|
|
171
184
|
|
|
172
185
|
print("[ExpoSettings] Stream and connection closed and resources released")
|
|
173
|
-
|
|
186
|
+
|
|
187
|
+
self.currentStreamStatus = "stopped"
|
|
188
|
+
sendEvent("onStreamStatus", ["status": self.currentStreamStatus])
|
|
174
189
|
}
|
|
175
190
|
}
|
|
176
191
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "blix-expo-settings",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "LiveStream",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -28,11 +28,10 @@
|
|
|
28
28
|
"author": "Blix <blix.aplicativos@gmail.com> (https://github.com/BlixTechnology)",
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"homepage": "https://github.com/BlixTechnology/expo-settings#readme",
|
|
31
|
-
"dependencies": {},
|
|
32
31
|
"devDependencies": {
|
|
33
32
|
"@types/react": "~19.0.0",
|
|
34
|
-
"expo-module-scripts": "^4.1.6",
|
|
35
33
|
"expo": "^50.0.21",
|
|
34
|
+
"expo-module-scripts": "^4.1.7",
|
|
36
35
|
"react-native": "0.79.1"
|
|
37
36
|
},
|
|
38
37
|
"peerDependencies": {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { Platform } from 'react-native';
|
|
2
2
|
import { requireNativeModule } from 'expo-modules-core';
|
|
3
3
|
|
|
4
|
+
|
|
4
5
|
// Só carrega o native module no iOS; no Android, exporta stubs vazios
|
|
5
6
|
const ExpoSettingsModule = Platform.OS === 'ios'
|
|
6
7
|
? requireNativeModule('ExpoSettings')
|
|
7
8
|
: {
|
|
8
9
|
// Métodos usados pelo seu fluxo de live-stream
|
|
9
10
|
initializePreview: () => Promise.resolve(), // se for async, senão só () => {}
|
|
10
|
-
startStream: (_url: string, _streamKey: string) => {},
|
|
11
11
|
publishStream: (_url: string, _streamKey: string) => {},
|
|
12
12
|
stopStream: () => {},
|
|
13
|
+
getStreamStatus: () => Promise.resolve('stopped'),
|
|
13
14
|
};
|
|
14
15
|
|
|
15
16
|
export default ExpoSettingsModule;
|
|
16
|
-
|
package/src/ExpoSettingsView.tsx
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import { EventEmitter, Subscription } from "expo-modules-core";
|
|
2
2
|
import ExpoSettingsModule from "./ExpoSettingsModule";
|
|
3
|
-
import ExpoSettingsView from './ExpoSettingsView';
|
|
3
|
+
import ExpoSettingsView from './ExpoSettingsView';
|
|
4
4
|
|
|
5
5
|
const emitter = new EventEmitter(ExpoSettingsModule);
|
|
6
6
|
|
|
7
|
-
export { ExpoSettingsView };
|
|
7
|
+
export { ExpoSettingsView };
|
|
8
8
|
|
|
9
9
|
export type LiveChangeEvent = {
|
|
10
|
-
status:
|
|
10
|
+
status:
|
|
11
|
+
| "previewInitializing"
|
|
12
|
+
| "previewReady"
|
|
13
|
+
| "connecting"
|
|
14
|
+
| "connected"
|
|
15
|
+
| "publishing"
|
|
16
|
+
| "started"
|
|
17
|
+
| "stopped";
|
|
11
18
|
};
|
|
12
19
|
|
|
13
20
|
export function addLiveListener(
|
|
@@ -21,7 +28,7 @@ export function initializePreview(): void {
|
|
|
21
28
|
}
|
|
22
29
|
|
|
23
30
|
// ← RENOMEADO startStream → publishStream, agora só publica
|
|
24
|
-
export function publishStream(url:
|
|
31
|
+
export function publishStream(url: string, streamKey: string): void {
|
|
25
32
|
return ExpoSettingsModule.publishStream(url, streamKey);
|
|
26
33
|
}
|
|
27
34
|
|
|
@@ -29,7 +36,6 @@ export function stopStream(): void {
|
|
|
29
36
|
return ExpoSettingsModule.stopStream();
|
|
30
37
|
}
|
|
31
38
|
|
|
32
|
-
export function
|
|
33
|
-
return ExpoSettingsModule.
|
|
34
|
-
|
|
35
|
-
|
|
39
|
+
export async function getStreamStatus(): Promise<string> {
|
|
40
|
+
return await ExpoSettingsModule.getStreamStatus();
|
|
41
|
+
}
|