kasunk99-livestream-core 0.3.3 → 0.3.4
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LiveStreamViewerItem.d.ts","sourceRoot":"","sources":["../../src/components/LiveStreamViewerItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqD,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"LiveStreamViewerItem.d.ts","sourceRoot":"","sources":["../../src/components/LiveStreamViewerItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqD,MAAM,OAAO,CAAC;AAe1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAK/C,KAAK,yBAAyB,GAAG;IAC/B,MAAM,EAAE,cAAc,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAgBF;;GAEG;AACH,eAAO,MAAM,oBAAoB,uDA4V/B,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { memo, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
-
import { Animated, Dimensions, Keyboard, Platform, ScrollView, StyleSheet, Text, TextInput, TouchableOpacity, View, } from 'react-native';
|
|
3
|
+
import { Animated, Dimensions, Keyboard, NativeModules, Platform, ScrollView, StyleSheet, Text, TextInput, TouchableOpacity, View, } from 'react-native';
|
|
4
4
|
import { useViewerSocket } from '../hooks/useViewerSocket';
|
|
5
5
|
const { width: SCREEN_WIDTH, height: SCREEN_HEIGHT } = Dimensions.get('window');
|
|
6
6
|
const CHAT_NAME_COLORS = ['#f97316', '#22c55e', '#3b82f6', '#eab308', '#ec4899', '#a855f7'];
|
|
@@ -151,6 +151,36 @@ export const LiveStreamViewerItem = memo(function LiveStreamViewerItem({ stream,
|
|
|
151
151
|
// ignore scroll errors
|
|
152
152
|
}
|
|
153
153
|
}, [chatData.length]);
|
|
154
|
+
// System audio playback (Android only — receives AAC chunks from host during screen sharing)
|
|
155
|
+
useEffect(() => {
|
|
156
|
+
if (!socket || !joined || !isActive || Platform.OS !== 'android')
|
|
157
|
+
return;
|
|
158
|
+
let playerStarted = false;
|
|
159
|
+
const onChunk = async (payload) => {
|
|
160
|
+
const b64 = payload?.data;
|
|
161
|
+
if (!b64)
|
|
162
|
+
return;
|
|
163
|
+
try {
|
|
164
|
+
const player = NativeModules.ScreenSystemAudioPlayer;
|
|
165
|
+
if (!player)
|
|
166
|
+
return;
|
|
167
|
+
if (!playerStarted) {
|
|
168
|
+
await player.startPlayback();
|
|
169
|
+
playerStarted = true;
|
|
170
|
+
}
|
|
171
|
+
player.feedChunk(b64);
|
|
172
|
+
}
|
|
173
|
+
catch { /* ignore */ }
|
|
174
|
+
};
|
|
175
|
+
socket.on('system-audio-chunk', onChunk);
|
|
176
|
+
return () => {
|
|
177
|
+
socket.off('system-audio-chunk', onChunk);
|
|
178
|
+
if (playerStarted) {
|
|
179
|
+
const player = NativeModules.ScreenSystemAudioPlayer;
|
|
180
|
+
player?.stopPlayback();
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
}, [socket, joined, isActive]);
|
|
154
184
|
const getNameColor = (name) => {
|
|
155
185
|
if (!name)
|
|
156
186
|
return CHAT_NAME_COLORS[0];
|
package/package.json
CHANGED