@syra.fm/sdk 0.4.0 → 0.5.0
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/lib/commonjs/client.js +268 -0
- package/lib/commonjs/client.js.map +1 -0
- package/lib/commonjs/errors.js +22 -0
- package/lib/commonjs/errors.js.map +1 -0
- package/lib/commonjs/index.js +63 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/index.native.js +28 -0
- package/lib/commonjs/index.native.js.map +1 -0
- package/lib/commonjs/live/assets/icons/spaces-icon.js +42 -0
- package/lib/commonjs/live/assets/icons/spaces-icon.js.map +1 -0
- package/lib/commonjs/live/assets/icons/syra-icon.js +43 -0
- package/lib/commonjs/live/assets/icons/syra-icon.js.map +1 -0
- package/lib/commonjs/live/components/AnimatedPulse.js +38 -0
- package/lib/commonjs/live/components/AnimatedPulse.js.map +1 -0
- package/lib/commonjs/live/components/AnimatedSpeakerRing.js +90 -0
- package/lib/commonjs/live/components/AnimatedSpeakerRing.js.map +1 -0
- package/lib/commonjs/live/components/CreateRoomSheet.js +688 -0
- package/lib/commonjs/live/components/CreateRoomSheet.js.map +1 -0
- package/lib/commonjs/live/components/InsightsPanel.js +333 -0
- package/lib/commonjs/live/components/InsightsPanel.js.map +1 -0
- package/lib/commonjs/live/components/LiveRoomSheet.js +1195 -0
- package/lib/commonjs/live/components/LiveRoomSheet.js.map +1 -0
- package/lib/commonjs/live/components/MiniRoomBar.js +161 -0
- package/lib/commonjs/live/components/MiniRoomBar.js.map +1 -0
- package/lib/commonjs/live/components/PanelHeader.js +57 -0
- package/lib/commonjs/live/components/PanelHeader.js.map +1 -0
- package/lib/commonjs/live/components/PodcastStreamPicker.js +1190 -0
- package/lib/commonjs/live/components/PodcastStreamPicker.js.map +1 -0
- package/lib/commonjs/live/components/RecordingCard.js +192 -0
- package/lib/commonjs/live/components/RecordingCard.js.map +1 -0
- package/lib/commonjs/live/components/RecordingsPanel.js +304 -0
- package/lib/commonjs/live/components/RecordingsPanel.js.map +1 -0
- package/lib/commonjs/live/components/RoomCard.js +553 -0
- package/lib/commonjs/live/components/RoomCard.js.map +1 -0
- package/lib/commonjs/live/components/StreamConfigModal.js +656 -0
- package/lib/commonjs/live/components/StreamConfigModal.js.map +1 -0
- package/lib/commonjs/live/components/StreamConfigPanel.js +822 -0
- package/lib/commonjs/live/components/StreamConfigPanel.js.map +1 -0
- package/lib/commonjs/live/context/LiveConfigContext.js +46 -0
- package/lib/commonjs/live/context/LiveConfigContext.js.map +1 -0
- package/lib/commonjs/live/context/LiveRoomContext.js +195 -0
- package/lib/commonjs/live/context/LiveRoomContext.js.map +1 -0
- package/lib/commonjs/live/hooks/useActiveSpeakers.js +35 -0
- package/lib/commonjs/live/hooks/useActiveSpeakers.js.map +1 -0
- package/lib/commonjs/live/hooks/useRoomAudio.js +129 -0
- package/lib/commonjs/live/hooks/useRoomAudio.js.map +1 -0
- package/lib/commonjs/live/hooks/useRoomConnection.js +177 -0
- package/lib/commonjs/live/hooks/useRoomConnection.js.map +1 -0
- package/lib/commonjs/live/hooks/useRoomManager.js +37 -0
- package/lib/commonjs/live/hooks/useRoomManager.js.map +1 -0
- package/lib/commonjs/live/hooks/useRoomUsers.js +52 -0
- package/lib/commonjs/live/hooks/useRoomUsers.js.map +1 -0
- package/lib/commonjs/live/index.js +310 -0
- package/lib/commonjs/live/index.js.map +1 -0
- package/lib/commonjs/live/services/livekitService.js +20 -0
- package/lib/commonjs/live/services/livekitService.js.map +1 -0
- package/lib/commonjs/live/services/spaceSocketService.js +181 -0
- package/lib/commonjs/live/services/spaceSocketService.js.map +1 -0
- package/lib/commonjs/live/services/spacesService.js +642 -0
- package/lib/commonjs/live/services/spacesService.js.map +1 -0
- package/lib/commonjs/live/types.js +6 -0
- package/lib/commonjs/live/types.js.map +1 -0
- package/lib/commonjs/live/validation.js +238 -0
- package/lib/commonjs/live/validation.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/{dist/cjs → lib/commonjs}/schema.js +55 -47
- package/lib/commonjs/schema.js.map +1 -0
- package/lib/module/client.js +264 -0
- package/lib/module/client.js.map +1 -0
- package/lib/module/errors.js +17 -0
- package/lib/module/errors.js.map +1 -0
- package/lib/module/index.js +6 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/index.native.js +5 -0
- package/lib/module/index.native.js.map +1 -0
- package/lib/module/live/assets/icons/spaces-icon.js +34 -0
- package/lib/module/live/assets/icons/spaces-icon.js.map +1 -0
- package/lib/module/live/assets/icons/syra-icon.js +36 -0
- package/lib/module/live/assets/icons/syra-icon.js.map +1 -0
- package/lib/module/live/components/AnimatedPulse.js +33 -0
- package/lib/module/live/components/AnimatedPulse.js.map +1 -0
- package/lib/module/live/components/AnimatedSpeakerRing.js +85 -0
- package/lib/module/live/components/AnimatedSpeakerRing.js.map +1 -0
- package/lib/module/live/components/CreateRoomSheet.js +682 -0
- package/lib/module/live/components/CreateRoomSheet.js.map +1 -0
- package/lib/module/live/components/InsightsPanel.js +327 -0
- package/lib/module/live/components/InsightsPanel.js.map +1 -0
- package/lib/module/live/components/LiveRoomSheet.js +1189 -0
- package/lib/module/live/components/LiveRoomSheet.js.map +1 -0
- package/lib/module/live/components/MiniRoomBar.js +154 -0
- package/lib/module/live/components/MiniRoomBar.js.map +1 -0
- package/lib/module/live/components/PanelHeader.js +52 -0
- package/lib/module/live/components/PanelHeader.js.map +1 -0
- package/lib/module/live/components/PodcastStreamPicker.js +1183 -0
- package/lib/module/live/components/PodcastStreamPicker.js.map +1 -0
- package/lib/module/live/components/RecordingCard.js +187 -0
- package/lib/module/live/components/RecordingCard.js.map +1 -0
- package/lib/module/live/components/RecordingsPanel.js +298 -0
- package/lib/module/live/components/RecordingsPanel.js.map +1 -0
- package/lib/module/live/components/RoomCard.js +548 -0
- package/lib/module/live/components/RoomCard.js.map +1 -0
- package/lib/module/live/components/StreamConfigModal.js +650 -0
- package/lib/module/live/components/StreamConfigModal.js.map +1 -0
- package/lib/module/live/components/StreamConfigPanel.js +816 -0
- package/lib/module/live/components/StreamConfigPanel.js.map +1 -0
- package/lib/module/live/context/LiveConfigContext.js +40 -0
- package/lib/module/live/context/LiveConfigContext.js.map +1 -0
- package/lib/module/live/context/LiveRoomContext.js +189 -0
- package/lib/module/live/context/LiveRoomContext.js.map +1 -0
- package/lib/module/live/hooks/useActiveSpeakers.js +31 -0
- package/lib/module/live/hooks/useActiveSpeakers.js.map +1 -0
- package/lib/module/live/hooks/useRoomAudio.js +125 -0
- package/lib/module/live/hooks/useRoomAudio.js.map +1 -0
- package/lib/module/live/hooks/useRoomConnection.js +173 -0
- package/lib/module/live/hooks/useRoomConnection.js.map +1 -0
- package/lib/module/live/hooks/useRoomManager.js +32 -0
- package/lib/module/live/hooks/useRoomManager.js.map +1 -0
- package/lib/module/live/hooks/useRoomUsers.js +46 -0
- package/lib/module/live/hooks/useRoomUsers.js.map +1 -0
- package/lib/module/live/index.js +38 -0
- package/lib/module/live/index.js.map +1 -0
- package/lib/module/live/services/livekitService.js +16 -0
- package/lib/module/live/services/livekitService.js.map +1 -0
- package/lib/module/live/services/spaceSocketService.js +176 -0
- package/lib/module/live/services/spaceSocketService.js.map +1 -0
- package/lib/module/live/services/spacesService.js +639 -0
- package/lib/module/live/services/spacesService.js.map +1 -0
- package/lib/module/live/types.js +4 -0
- package/lib/module/live/types.js.map +1 -0
- package/lib/module/live/validation.js +229 -0
- package/lib/module/live/validation.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/{dist/esm → lib/module}/schema.js +47 -39
- package/lib/module/schema.js.map +1 -0
- package/{dist/types → lib/typescript/commonjs}/client.d.ts +1 -0
- package/lib/typescript/commonjs/client.d.ts.map +1 -0
- package/{dist/types → lib/typescript/commonjs}/errors.d.ts +1 -0
- package/lib/typescript/commonjs/errors.d.ts.map +1 -0
- package/{dist/types → lib/typescript/commonjs}/index.d.ts +1 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/index.native.d.ts +3 -0
- package/lib/typescript/commonjs/index.native.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/assets/icons/spaces-icon.d.ts +13 -0
- package/lib/typescript/commonjs/live/assets/icons/spaces-icon.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/assets/icons/syra-icon.d.ts +13 -0
- package/lib/typescript/commonjs/live/assets/icons/syra-icon.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/components/AnimatedPulse.d.ts +8 -0
- package/lib/typescript/commonjs/live/components/AnimatedPulse.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/components/AnimatedSpeakerRing.d.ts +10 -0
- package/lib/typescript/commonjs/live/components/AnimatedSpeakerRing.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/components/CreateRoomSheet.d.ts +26 -0
- package/lib/typescript/commonjs/live/components/CreateRoomSheet.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/components/InsightsPanel.d.ts +11 -0
- package/lib/typescript/commonjs/live/components/InsightsPanel.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/components/LiveRoomSheet.d.ts +11 -0
- package/lib/typescript/commonjs/live/components/LiveRoomSheet.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/components/MiniRoomBar.d.ts +15 -0
- package/lib/typescript/commonjs/live/components/MiniRoomBar.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/components/PanelHeader.d.ts +10 -0
- package/lib/typescript/commonjs/live/components/PanelHeader.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/components/PodcastStreamPicker.d.ts +54 -0
- package/lib/typescript/commonjs/live/components/PodcastStreamPicker.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/components/RecordingCard.d.ts +11 -0
- package/lib/typescript/commonjs/live/components/RecordingCard.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/components/RecordingsPanel.d.ts +12 -0
- package/lib/typescript/commonjs/live/components/RecordingsPanel.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/components/RoomCard.d.ts +38 -0
- package/lib/typescript/commonjs/live/components/RoomCard.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/components/StreamConfigModal.d.ts +11 -0
- package/lib/typescript/commonjs/live/components/StreamConfigModal.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/components/StreamConfigPanel.d.ts +13 -0
- package/lib/typescript/commonjs/live/components/StreamConfigPanel.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/context/LiveConfigContext.d.ts +78 -0
- package/lib/typescript/commonjs/live/context/LiveConfigContext.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/context/LiveRoomContext.d.ts +12 -0
- package/lib/typescript/commonjs/live/context/LiveRoomContext.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/hooks/useActiveSpeakers.d.ts +3 -0
- package/lib/typescript/commonjs/live/hooks/useActiveSpeakers.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/hooks/useRoomAudio.d.ts +16 -0
- package/lib/typescript/commonjs/live/hooks/useRoomAudio.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/hooks/useRoomConnection.d.ts +29 -0
- package/lib/typescript/commonjs/live/hooks/useRoomConnection.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/hooks/useRoomManager.d.ts +11 -0
- package/lib/typescript/commonjs/live/hooks/useRoomManager.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/hooks/useRoomUsers.d.ts +5 -0
- package/lib/typescript/commonjs/live/hooks/useRoomUsers.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/index.d.ts +24 -0
- package/lib/typescript/commonjs/live/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/services/livekitService.d.ts +7 -0
- package/lib/typescript/commonjs/live/services/livekitService.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/services/spaceSocketService.d.ts +69 -0
- package/lib/typescript/commonjs/live/services/spaceSocketService.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/services/spacesService.d.ts +181 -0
- package/lib/typescript/commonjs/live/services/spacesService.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/types.d.ts +100 -0
- package/lib/typescript/commonjs/live/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/validation.d.ts +658 -0
- package/lib/typescript/commonjs/live/validation.d.ts.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/{dist/types → lib/typescript/commonjs}/schema.d.ts +1 -0
- package/lib/typescript/commonjs/schema.d.ts.map +1 -0
- package/lib/typescript/module/client.d.ts +141 -0
- package/lib/typescript/module/client.d.ts.map +1 -0
- package/lib/typescript/module/errors.d.ts +9 -0
- package/lib/typescript/module/errors.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +6 -0
- package/lib/typescript/module/index.d.ts.map +1 -0
- package/lib/typescript/module/index.native.d.ts +3 -0
- package/lib/typescript/module/index.native.d.ts.map +1 -0
- package/lib/typescript/module/live/assets/icons/spaces-icon.d.ts +13 -0
- package/lib/typescript/module/live/assets/icons/spaces-icon.d.ts.map +1 -0
- package/lib/typescript/module/live/assets/icons/syra-icon.d.ts +13 -0
- package/lib/typescript/module/live/assets/icons/syra-icon.d.ts.map +1 -0
- package/lib/typescript/module/live/components/AnimatedPulse.d.ts +8 -0
- package/lib/typescript/module/live/components/AnimatedPulse.d.ts.map +1 -0
- package/lib/typescript/module/live/components/AnimatedSpeakerRing.d.ts +10 -0
- package/lib/typescript/module/live/components/AnimatedSpeakerRing.d.ts.map +1 -0
- package/lib/typescript/module/live/components/CreateRoomSheet.d.ts +26 -0
- package/lib/typescript/module/live/components/CreateRoomSheet.d.ts.map +1 -0
- package/lib/typescript/module/live/components/InsightsPanel.d.ts +11 -0
- package/lib/typescript/module/live/components/InsightsPanel.d.ts.map +1 -0
- package/lib/typescript/module/live/components/LiveRoomSheet.d.ts +11 -0
- package/lib/typescript/module/live/components/LiveRoomSheet.d.ts.map +1 -0
- package/lib/typescript/module/live/components/MiniRoomBar.d.ts +15 -0
- package/lib/typescript/module/live/components/MiniRoomBar.d.ts.map +1 -0
- package/lib/typescript/module/live/components/PanelHeader.d.ts +10 -0
- package/lib/typescript/module/live/components/PanelHeader.d.ts.map +1 -0
- package/lib/typescript/module/live/components/PodcastStreamPicker.d.ts +54 -0
- package/lib/typescript/module/live/components/PodcastStreamPicker.d.ts.map +1 -0
- package/lib/typescript/module/live/components/RecordingCard.d.ts +11 -0
- package/lib/typescript/module/live/components/RecordingCard.d.ts.map +1 -0
- package/lib/typescript/module/live/components/RecordingsPanel.d.ts +12 -0
- package/lib/typescript/module/live/components/RecordingsPanel.d.ts.map +1 -0
- package/lib/typescript/module/live/components/RoomCard.d.ts +38 -0
- package/lib/typescript/module/live/components/RoomCard.d.ts.map +1 -0
- package/lib/typescript/module/live/components/StreamConfigModal.d.ts +11 -0
- package/lib/typescript/module/live/components/StreamConfigModal.d.ts.map +1 -0
- package/lib/typescript/module/live/components/StreamConfigPanel.d.ts +13 -0
- package/lib/typescript/module/live/components/StreamConfigPanel.d.ts.map +1 -0
- package/lib/typescript/module/live/context/LiveConfigContext.d.ts +78 -0
- package/lib/typescript/module/live/context/LiveConfigContext.d.ts.map +1 -0
- package/lib/typescript/module/live/context/LiveRoomContext.d.ts +12 -0
- package/lib/typescript/module/live/context/LiveRoomContext.d.ts.map +1 -0
- package/lib/typescript/module/live/hooks/useActiveSpeakers.d.ts +3 -0
- package/lib/typescript/module/live/hooks/useActiveSpeakers.d.ts.map +1 -0
- package/lib/typescript/module/live/hooks/useRoomAudio.d.ts +16 -0
- package/lib/typescript/module/live/hooks/useRoomAudio.d.ts.map +1 -0
- package/lib/typescript/module/live/hooks/useRoomConnection.d.ts +29 -0
- package/lib/typescript/module/live/hooks/useRoomConnection.d.ts.map +1 -0
- package/lib/typescript/module/live/hooks/useRoomManager.d.ts +11 -0
- package/lib/typescript/module/live/hooks/useRoomManager.d.ts.map +1 -0
- package/lib/typescript/module/live/hooks/useRoomUsers.d.ts +5 -0
- package/lib/typescript/module/live/hooks/useRoomUsers.d.ts.map +1 -0
- package/lib/typescript/module/live/index.d.ts +24 -0
- package/lib/typescript/module/live/index.d.ts.map +1 -0
- package/lib/typescript/module/live/services/livekitService.d.ts +7 -0
- package/lib/typescript/module/live/services/livekitService.d.ts.map +1 -0
- package/lib/typescript/module/live/services/spaceSocketService.d.ts +69 -0
- package/lib/typescript/module/live/services/spaceSocketService.d.ts.map +1 -0
- package/lib/typescript/module/live/services/spacesService.d.ts +181 -0
- package/lib/typescript/module/live/services/spacesService.d.ts.map +1 -0
- package/lib/typescript/module/live/types.d.ts +100 -0
- package/lib/typescript/module/live/types.d.ts.map +1 -0
- package/lib/typescript/module/live/validation.d.ts +658 -0
- package/lib/typescript/module/live/validation.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/schema.d.ts +1072 -0
- package/lib/typescript/module/schema.d.ts.map +1 -0
- package/package.json +133 -21
- package/src/index.native.ts +2 -0
- package/src/live/assets/icons/spaces-icon.tsx +15 -0
- package/src/live/assets/icons/syra-icon.tsx +13 -0
- package/src/live/assets/sounds/intro.mp3 +0 -0
- package/src/live/components/AnimatedPulse.tsx +52 -0
- package/src/live/components/AnimatedSpeakerRing.tsx +101 -0
- package/src/live/components/CreateRoomSheet.tsx +654 -0
- package/src/live/components/InsightsPanel.tsx +202 -0
- package/src/live/components/LiveRoomSheet.tsx +969 -0
- package/src/live/components/MiniRoomBar.tsx +166 -0
- package/src/live/components/PanelHeader.tsx +36 -0
- package/src/live/components/PodcastStreamPicker.tsx +1155 -0
- package/src/live/components/RecordingCard.tsx +154 -0
- package/src/live/components/RecordingsPanel.tsx +251 -0
- package/src/live/components/RoomCard.tsx +494 -0
- package/src/live/components/StreamConfigModal.tsx +600 -0
- package/src/live/components/StreamConfigPanel.tsx +729 -0
- package/src/live/context/LiveConfigContext.tsx +96 -0
- package/src/live/context/LiveRoomContext.tsx +235 -0
- package/src/live/hooks/useActiveSpeakers.ts +39 -0
- package/src/live/hooks/useRoomAudio.ts +103 -0
- package/src/live/hooks/useRoomConnection.ts +162 -0
- package/src/live/hooks/useRoomManager.ts +17 -0
- package/src/live/hooks/useRoomUsers.ts +52 -0
- package/src/live/index.ts +92 -0
- package/src/live/services/livekitService.ts +11 -0
- package/src/live/services/spaceSocketService.ts +136 -0
- package/src/live/services/spacesService.ts +692 -0
- package/src/live/types.ts +119 -0
- package/src/live/validation.ts +279 -0
- package/dist/cjs/client.js +0 -244
- package/dist/cjs/errors.js +0 -16
- package/dist/cjs/index.js +0 -15
- package/dist/cjs/package.json +0 -3
- package/dist/esm/client.js +0 -240
- package/dist/esm/errors.js +0 -12
- package/dist/esm/index.js +0 -3
- package/dist/esm/package.json +0 -3
|
@@ -0,0 +1,729 @@
|
|
|
1
|
+
import React, { useState, useEffect, useRef } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
Text,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
TouchableOpacity,
|
|
7
|
+
TextInput,
|
|
8
|
+
Image,
|
|
9
|
+
ActivityIndicator,
|
|
10
|
+
Platform,
|
|
11
|
+
ScrollView,
|
|
12
|
+
} from 'react-native';
|
|
13
|
+
import MaterialCommunityIcons from '@expo/vector-icons/MaterialCommunityIcons';
|
|
14
|
+
import * as ImagePicker from 'expo-image-picker';
|
|
15
|
+
|
|
16
|
+
import { useLiveConfig } from '../context/LiveConfigContext';
|
|
17
|
+
import { PanelHeader } from './PanelHeader';
|
|
18
|
+
import { PodcastStreamPicker, MusicPicker } from './PodcastStreamPicker';
|
|
19
|
+
|
|
20
|
+
interface StreamConfigPanelProps {
|
|
21
|
+
roomId: string;
|
|
22
|
+
roomStatus?: string;
|
|
23
|
+
initialStreamUrl?: string;
|
|
24
|
+
initialRtmpUrl?: string;
|
|
25
|
+
initialStreamKey?: string;
|
|
26
|
+
onClose: () => void;
|
|
27
|
+
onStreamStarted: () => void;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
type StreamMode = 'url' | 'rtmp' | 'podcast' | 'music';
|
|
31
|
+
|
|
32
|
+
type NativeFormDataFile = {
|
|
33
|
+
uri: string;
|
|
34
|
+
name: string;
|
|
35
|
+
type: string;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
interface NativeFormDataAppender {
|
|
39
|
+
append(name: string, value: NativeFormDataFile): void;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function appendNativeFile(formData: FormData, file: NativeFormDataFile): void {
|
|
43
|
+
const nativeFormData = formData as unknown as NativeFormDataAppender;
|
|
44
|
+
nativeFormData.append('file', file);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function StreamConfigPanel({ roomId, roomStatus, initialStreamUrl, initialRtmpUrl, initialStreamKey, onClose, onStreamStarted }: StreamConfigPanelProps) {
|
|
48
|
+
const { useTheme, roomsService, toast, onRoomChanged } = useLiveConfig();
|
|
49
|
+
const theme = useTheme();
|
|
50
|
+
|
|
51
|
+
const initialUrl = initialStreamUrl?.trim() ?? '';
|
|
52
|
+
const hasExistingKey = !!(initialStreamKey);
|
|
53
|
+
const isEditingUrlStream = roomStatus === 'live' && initialUrl.length > 0;
|
|
54
|
+
const [mode, setMode] = useState<StreamMode>(hasExistingKey ? 'rtmp' : 'url');
|
|
55
|
+
const [loading, setLoading] = useState(false);
|
|
56
|
+
|
|
57
|
+
const [streamUrl, setStreamUrl] = useState(initialUrl);
|
|
58
|
+
|
|
59
|
+
const [rtmpUrl, setRtmpUrl] = useState<string | null>(initialRtmpUrl || null);
|
|
60
|
+
const [streamKey, setStreamKey] = useState<string | null>(initialStreamKey || null);
|
|
61
|
+
const [generatingKey, setGeneratingKey] = useState(false);
|
|
62
|
+
|
|
63
|
+
const [title, setTitle] = useState('');
|
|
64
|
+
const [description, setDescription] = useState('');
|
|
65
|
+
const [imageCdnUrl, setImageCdnUrl] = useState<string | null>(null);
|
|
66
|
+
const [imagePreviewUri, setImagePreviewUri] = useState<string | null>(null);
|
|
67
|
+
const [uploadingImage, setUploadingImage] = useState(false);
|
|
68
|
+
|
|
69
|
+
const resetState = () => {
|
|
70
|
+
setStreamUrl('');
|
|
71
|
+
setRtmpUrl(null);
|
|
72
|
+
setStreamKey(null);
|
|
73
|
+
setTitle('');
|
|
74
|
+
setDescription('');
|
|
75
|
+
setImageCdnUrl(null);
|
|
76
|
+
setImagePreviewUri(null);
|
|
77
|
+
setMode('url');
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const handlePickImage = async () => {
|
|
81
|
+
try {
|
|
82
|
+
const result = await ImagePicker.launchImageLibraryAsync({
|
|
83
|
+
mediaTypes: ['images'],
|
|
84
|
+
quality: 0.8,
|
|
85
|
+
allowsEditing: true,
|
|
86
|
+
aspect: [16, 9],
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
if (result.canceled || !result.assets?.[0]) return;
|
|
90
|
+
|
|
91
|
+
const asset = result.assets[0];
|
|
92
|
+
setImagePreviewUri(asset.uri);
|
|
93
|
+
setUploadingImage(true);
|
|
94
|
+
|
|
95
|
+
try {
|
|
96
|
+
const formData = new FormData();
|
|
97
|
+
if (Platform.OS === 'web') {
|
|
98
|
+
const response = await fetch(asset.uri);
|
|
99
|
+
const blob = await response.blob();
|
|
100
|
+
formData.append('file', new File([blob], 'stream-cover.jpg', { type: asset.mimeType || 'image/jpeg' }));
|
|
101
|
+
} else {
|
|
102
|
+
const nativeFile: NativeFormDataFile = {
|
|
103
|
+
uri: asset.uri,
|
|
104
|
+
name: 'stream-cover.jpg',
|
|
105
|
+
type: asset.mimeType || 'image/jpeg',
|
|
106
|
+
};
|
|
107
|
+
appendNativeFile(formData, nativeFile);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const cdnUrl = await roomsService.uploadRoomImage(roomId, formData);
|
|
111
|
+
if (cdnUrl) {
|
|
112
|
+
setImageCdnUrl(cdnUrl);
|
|
113
|
+
} else {
|
|
114
|
+
toast.error('Failed to upload image');
|
|
115
|
+
setImagePreviewUri(null);
|
|
116
|
+
}
|
|
117
|
+
} catch (err) {
|
|
118
|
+
console.error('Image upload error:', err);
|
|
119
|
+
toast.error('Failed to upload image');
|
|
120
|
+
setImagePreviewUri(null);
|
|
121
|
+
} finally {
|
|
122
|
+
setUploadingImage(false);
|
|
123
|
+
}
|
|
124
|
+
} catch (err) {
|
|
125
|
+
console.error('Image picker error:', err);
|
|
126
|
+
toast.error('Could not open image picker');
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
const ensureRoomLive = async (): Promise<boolean> => {
|
|
131
|
+
if (roomStatus === 'live') return true;
|
|
132
|
+
if (roomStatus === 'scheduled') {
|
|
133
|
+
const started = await roomsService.startRoom(roomId);
|
|
134
|
+
if (!started) {
|
|
135
|
+
toast.error('Failed to start room');
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
onRoomChanged?.(roomId);
|
|
139
|
+
return true;
|
|
140
|
+
}
|
|
141
|
+
toast.error('Room cannot be started');
|
|
142
|
+
return false;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const handleStartUrlStream = async () => {
|
|
146
|
+
if (!streamUrl.trim() || loading) return;
|
|
147
|
+
setLoading(true);
|
|
148
|
+
try {
|
|
149
|
+
if (!(await ensureRoomLive())) return;
|
|
150
|
+
const result = await roomsService.startStream(roomId, {
|
|
151
|
+
url: streamUrl.trim(),
|
|
152
|
+
title: title.trim() || undefined,
|
|
153
|
+
image: imageCdnUrl || undefined,
|
|
154
|
+
description: description.trim() || undefined,
|
|
155
|
+
});
|
|
156
|
+
if (result) {
|
|
157
|
+
toast.success('Stream started');
|
|
158
|
+
resetState();
|
|
159
|
+
onStreamStarted();
|
|
160
|
+
onClose();
|
|
161
|
+
} else {
|
|
162
|
+
toast.error('Failed to start stream');
|
|
163
|
+
}
|
|
164
|
+
} catch {
|
|
165
|
+
toast.error('Failed to start stream');
|
|
166
|
+
} finally {
|
|
167
|
+
setLoading(false);
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
const handleStartPodcast = async (syraPodcastId: string, episodeId: string) => {
|
|
172
|
+
if (loading) return;
|
|
173
|
+
setLoading(true);
|
|
174
|
+
try {
|
|
175
|
+
if (!(await ensureRoomLive())) return;
|
|
176
|
+
const result = await roomsService.startPodcastStream(roomId, { syraPodcastId, episodeId });
|
|
177
|
+
if (result) {
|
|
178
|
+
toast.success('Stream started');
|
|
179
|
+
resetState();
|
|
180
|
+
onStreamStarted();
|
|
181
|
+
onClose();
|
|
182
|
+
} else {
|
|
183
|
+
toast.error('Failed to start stream');
|
|
184
|
+
}
|
|
185
|
+
} catch {
|
|
186
|
+
toast.error('Failed to start stream');
|
|
187
|
+
} finally {
|
|
188
|
+
setLoading(false);
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
// Start a multi-episode session: the first episode plays now, the rest are
|
|
193
|
+
// persisted as the room's up-next queue.
|
|
194
|
+
const handleStartPodcastQueue = async (items: { syraPodcastId: string; episodeId: string }[]) => {
|
|
195
|
+
if (loading || items.length === 0) return;
|
|
196
|
+
const [first, ...rest] = items;
|
|
197
|
+
setLoading(true);
|
|
198
|
+
try {
|
|
199
|
+
if (!(await ensureRoomLive())) return;
|
|
200
|
+
const result = await roomsService.startPodcastStream(roomId, {
|
|
201
|
+
syraPodcastId: first.syraPodcastId,
|
|
202
|
+
episodeId: first.episodeId,
|
|
203
|
+
queue: rest,
|
|
204
|
+
});
|
|
205
|
+
if (result) {
|
|
206
|
+
toast.success('Stream started');
|
|
207
|
+
resetState();
|
|
208
|
+
onStreamStarted();
|
|
209
|
+
onClose();
|
|
210
|
+
} else {
|
|
211
|
+
toast.error('Failed to start stream');
|
|
212
|
+
}
|
|
213
|
+
} catch {
|
|
214
|
+
toast.error('Failed to start stream');
|
|
215
|
+
} finally {
|
|
216
|
+
setLoading(false);
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
// Stream a single Syra track into the room (a "listening party").
|
|
221
|
+
const handleStartTrack = async (trackId: string) => {
|
|
222
|
+
if (loading) return;
|
|
223
|
+
setLoading(true);
|
|
224
|
+
try {
|
|
225
|
+
if (!(await ensureRoomLive())) return;
|
|
226
|
+
const result = await roomsService.startTrackStream(roomId, { trackId });
|
|
227
|
+
if (result) {
|
|
228
|
+
toast.success('Stream started');
|
|
229
|
+
resetState();
|
|
230
|
+
onStreamStarted();
|
|
231
|
+
onClose();
|
|
232
|
+
} else {
|
|
233
|
+
toast.error('Failed to start stream');
|
|
234
|
+
}
|
|
235
|
+
} catch {
|
|
236
|
+
toast.error('Failed to start stream');
|
|
237
|
+
} finally {
|
|
238
|
+
setLoading(false);
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
// Start a multi-track session: the first track plays now, the rest are
|
|
243
|
+
// persisted as the room's up-next queue.
|
|
244
|
+
const handleStartTrackQueue = async (trackIds: string[]) => {
|
|
245
|
+
if (loading || trackIds.length === 0) return;
|
|
246
|
+
const [first, ...rest] = trackIds;
|
|
247
|
+
setLoading(true);
|
|
248
|
+
try {
|
|
249
|
+
if (!(await ensureRoomLive())) return;
|
|
250
|
+
const result = await roomsService.startTrackStream(roomId, {
|
|
251
|
+
trackId: first,
|
|
252
|
+
queue: rest.map((trackId) => ({ trackId })),
|
|
253
|
+
});
|
|
254
|
+
if (result) {
|
|
255
|
+
toast.success('Stream started');
|
|
256
|
+
resetState();
|
|
257
|
+
onStreamStarted();
|
|
258
|
+
onClose();
|
|
259
|
+
} else {
|
|
260
|
+
toast.error('Failed to start stream');
|
|
261
|
+
}
|
|
262
|
+
} catch {
|
|
263
|
+
toast.error('Failed to start stream');
|
|
264
|
+
} finally {
|
|
265
|
+
setLoading(false);
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
const generatingRef = useRef(false);
|
|
270
|
+
|
|
271
|
+
const generateKey = async () => {
|
|
272
|
+
if (generatingRef.current) return;
|
|
273
|
+
generatingRef.current = true;
|
|
274
|
+
setGeneratingKey(true);
|
|
275
|
+
try {
|
|
276
|
+
if (!(await ensureRoomLive())) return;
|
|
277
|
+
const result = await roomsService.generateStreamKey(roomId, {
|
|
278
|
+
title: title.trim() || undefined,
|
|
279
|
+
image: imageCdnUrl || undefined,
|
|
280
|
+
description: description.trim() || undefined,
|
|
281
|
+
});
|
|
282
|
+
if (result?.streamKey) {
|
|
283
|
+
setRtmpUrl(result.rtmpUrl || '');
|
|
284
|
+
setStreamKey(result.streamKey);
|
|
285
|
+
} else {
|
|
286
|
+
console.error('Generate stream key response:', JSON.stringify(result, null, 2));
|
|
287
|
+
toast.error('Failed to generate stream key');
|
|
288
|
+
}
|
|
289
|
+
} catch (err: unknown) {
|
|
290
|
+
console.error('Generate stream key error:', err);
|
|
291
|
+
const msg = err instanceof Error ? err.message : 'Unknown error';
|
|
292
|
+
toast.error(`Stream key error: ${msg}`);
|
|
293
|
+
} finally {
|
|
294
|
+
setGeneratingKey(false);
|
|
295
|
+
generatingRef.current = false;
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
// Auto-generate RTMP credentials when switching to the External App tab
|
|
300
|
+
useEffect(() => {
|
|
301
|
+
if (mode === 'rtmp' && !streamKey && !generatingRef.current) {
|
|
302
|
+
generateKey();
|
|
303
|
+
}
|
|
304
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
305
|
+
}, [mode]);
|
|
306
|
+
|
|
307
|
+
const handleUpdateMetadata = async () => {
|
|
308
|
+
if (loading) return;
|
|
309
|
+
const trimmedUrl = streamUrl.trim();
|
|
310
|
+
if (mode === 'url' && !trimmedUrl) {
|
|
311
|
+
toast.error('Stream URL is required');
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
setLoading(true);
|
|
315
|
+
try {
|
|
316
|
+
const success = await roomsService.updateStreamMetadata(roomId, {
|
|
317
|
+
...(mode === 'url' ? { url: trimmedUrl } : {}),
|
|
318
|
+
title: title.trim() || undefined,
|
|
319
|
+
image: imageCdnUrl || undefined,
|
|
320
|
+
description: description.trim() || undefined,
|
|
321
|
+
});
|
|
322
|
+
if (success) {
|
|
323
|
+
toast.success('Stream info updated');
|
|
324
|
+
onStreamStarted();
|
|
325
|
+
} else {
|
|
326
|
+
toast.error('Failed to update stream info');
|
|
327
|
+
}
|
|
328
|
+
} catch {
|
|
329
|
+
toast.error('Failed to update stream info');
|
|
330
|
+
} finally {
|
|
331
|
+
setLoading(false);
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
const copyToClipboard = async (text: string, label: string) => {
|
|
336
|
+
try {
|
|
337
|
+
if (Platform.OS === 'web') {
|
|
338
|
+
await navigator.clipboard.writeText(text);
|
|
339
|
+
} else {
|
|
340
|
+
const { Clipboard } = require('react-native');
|
|
341
|
+
Clipboard.setString(text);
|
|
342
|
+
}
|
|
343
|
+
toast.success(`${label} copied`);
|
|
344
|
+
} catch {
|
|
345
|
+
toast.error('Failed to copy');
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
return (
|
|
350
|
+
<View style={styles.container}>
|
|
351
|
+
<PanelHeader title="Stream Setup" theme={theme} onBack={onClose} />
|
|
352
|
+
|
|
353
|
+
<View style={styles.modeSelector}>
|
|
354
|
+
<TouchableOpacity
|
|
355
|
+
style={[
|
|
356
|
+
styles.modeTab,
|
|
357
|
+
{ borderColor: theme.colors.border },
|
|
358
|
+
mode === 'url' && { backgroundColor: theme.colors.primary, borderColor: theme.colors.primary },
|
|
359
|
+
]}
|
|
360
|
+
onPress={() => setMode('url')}
|
|
361
|
+
>
|
|
362
|
+
<MaterialCommunityIcons name="link" size={16} color={mode === 'url' ? '#FFFFFF' : theme.colors.text} />
|
|
363
|
+
<Text style={[styles.modeTabText, { color: mode === 'url' ? '#FFFFFF' : theme.colors.text }]}>
|
|
364
|
+
Stream URL
|
|
365
|
+
</Text>
|
|
366
|
+
</TouchableOpacity>
|
|
367
|
+
<TouchableOpacity
|
|
368
|
+
style={[
|
|
369
|
+
styles.modeTab,
|
|
370
|
+
{ borderColor: theme.colors.border },
|
|
371
|
+
mode === 'rtmp' && { backgroundColor: theme.colors.primary, borderColor: theme.colors.primary },
|
|
372
|
+
]}
|
|
373
|
+
onPress={() => setMode('rtmp')}
|
|
374
|
+
>
|
|
375
|
+
<MaterialCommunityIcons name="key" size={16} color={mode === 'rtmp' ? '#FFFFFF' : theme.colors.text} />
|
|
376
|
+
<Text style={[styles.modeTabText, { color: mode === 'rtmp' ? '#FFFFFF' : theme.colors.text }]}>
|
|
377
|
+
External App
|
|
378
|
+
</Text>
|
|
379
|
+
</TouchableOpacity>
|
|
380
|
+
<TouchableOpacity
|
|
381
|
+
style={[
|
|
382
|
+
styles.modeTab,
|
|
383
|
+
{ borderColor: theme.colors.border },
|
|
384
|
+
mode === 'podcast' && { backgroundColor: theme.colors.primary, borderColor: theme.colors.primary },
|
|
385
|
+
]}
|
|
386
|
+
onPress={() => setMode('podcast')}
|
|
387
|
+
>
|
|
388
|
+
<MaterialCommunityIcons name="podcast" size={16} color={mode === 'podcast' ? '#FFFFFF' : theme.colors.text} />
|
|
389
|
+
<Text style={[styles.modeTabText, { color: mode === 'podcast' ? '#FFFFFF' : theme.colors.text }]}>
|
|
390
|
+
Podcast
|
|
391
|
+
</Text>
|
|
392
|
+
</TouchableOpacity>
|
|
393
|
+
<TouchableOpacity
|
|
394
|
+
style={[
|
|
395
|
+
styles.modeTab,
|
|
396
|
+
{ borderColor: theme.colors.border },
|
|
397
|
+
mode === 'music' && { backgroundColor: theme.colors.primary, borderColor: theme.colors.primary },
|
|
398
|
+
]}
|
|
399
|
+
onPress={() => setMode('music')}
|
|
400
|
+
>
|
|
401
|
+
<MaterialCommunityIcons name="music" size={16} color={mode === 'music' ? '#FFFFFF' : theme.colors.text} />
|
|
402
|
+
<Text style={[styles.modeTabText, { color: mode === 'music' ? '#FFFFFF' : theme.colors.text }]}>
|
|
403
|
+
Music
|
|
404
|
+
</Text>
|
|
405
|
+
</TouchableOpacity>
|
|
406
|
+
</View>
|
|
407
|
+
|
|
408
|
+
{mode === 'podcast' ? (
|
|
409
|
+
<PodcastStreamPicker onSelectEpisode={handleStartPodcast} onStartQueue={handleStartPodcastQueue} />
|
|
410
|
+
) : mode === 'music' ? (
|
|
411
|
+
<MusicPicker onSelectTrack={handleStartTrack} onStartQueue={handleStartTrackQueue} />
|
|
412
|
+
) : (
|
|
413
|
+
<ScrollView
|
|
414
|
+
style={{ flex: 1 }}
|
|
415
|
+
contentContainerStyle={styles.scrollContent}
|
|
416
|
+
showsVerticalScrollIndicator={false}
|
|
417
|
+
keyboardShouldPersistTaps="handled"
|
|
418
|
+
>
|
|
419
|
+
{mode === 'url' && (
|
|
420
|
+
<View style={styles.section}>
|
|
421
|
+
<TextInput
|
|
422
|
+
style={[styles.input, { backgroundColor: `${theme.colors.card}80`, borderColor: theme.colors.border, color: theme.colors.text }]}
|
|
423
|
+
placeholder="Stream URL (m3u8, Icecast, etc.)"
|
|
424
|
+
placeholderTextColor={theme.colors.textSecondary}
|
|
425
|
+
value={streamUrl}
|
|
426
|
+
onChangeText={setStreamUrl}
|
|
427
|
+
autoCapitalize="none"
|
|
428
|
+
autoCorrect={false}
|
|
429
|
+
keyboardType="url"
|
|
430
|
+
/>
|
|
431
|
+
</View>
|
|
432
|
+
)}
|
|
433
|
+
|
|
434
|
+
{mode === 'rtmp' && (
|
|
435
|
+
<View style={styles.section}>
|
|
436
|
+
{!streamKey ? (
|
|
437
|
+
<View style={styles.loadingBox}>
|
|
438
|
+
<ActivityIndicator size="small" color={theme.colors.primary} />
|
|
439
|
+
<Text style={[styles.loadingText, { color: theme.colors.textSecondary }]}>
|
|
440
|
+
Generating stream key...
|
|
441
|
+
</Text>
|
|
442
|
+
</View>
|
|
443
|
+
) : (
|
|
444
|
+
<View style={styles.credentialsBox}>
|
|
445
|
+
<Text style={[styles.credLabel, { color: theme.colors.textSecondary }]}>RTMP URL</Text>
|
|
446
|
+
<View style={[styles.credRow, { backgroundColor: `${theme.colors.card}80`, borderColor: theme.colors.border }]}>
|
|
447
|
+
<Text style={[styles.credValue, { color: theme.colors.text }]} numberOfLines={1}>
|
|
448
|
+
{rtmpUrl}
|
|
449
|
+
</Text>
|
|
450
|
+
<TouchableOpacity onPress={() => copyToClipboard(rtmpUrl ?? '', 'RTMP URL')} style={styles.copyBtn}>
|
|
451
|
+
<MaterialCommunityIcons name="content-copy" size={18} color={theme.colors.primary} />
|
|
452
|
+
</TouchableOpacity>
|
|
453
|
+
</View>
|
|
454
|
+
|
|
455
|
+
<Text style={[styles.credLabel, { color: theme.colors.textSecondary, marginTop: 12 }]}>Stream Key</Text>
|
|
456
|
+
<View style={[styles.credRow, { backgroundColor: `${theme.colors.card}80`, borderColor: theme.colors.border }]}>
|
|
457
|
+
<Text style={[styles.credValue, { color: theme.colors.text }]} numberOfLines={1}>
|
|
458
|
+
{streamKey}
|
|
459
|
+
</Text>
|
|
460
|
+
<TouchableOpacity
|
|
461
|
+
onPress={() => {
|
|
462
|
+
if (streamKey) copyToClipboard(streamKey, 'Stream key');
|
|
463
|
+
}}
|
|
464
|
+
style={styles.copyBtn}
|
|
465
|
+
>
|
|
466
|
+
<MaterialCommunityIcons name="content-copy" size={18} color={theme.colors.primary} />
|
|
467
|
+
</TouchableOpacity>
|
|
468
|
+
</View>
|
|
469
|
+
|
|
470
|
+
<View style={styles.infoRow}>
|
|
471
|
+
<MaterialCommunityIcons name="information" size={16} color={theme.colors.textSecondary} />
|
|
472
|
+
<Text style={[styles.infoText, { color: theme.colors.textSecondary }]}>
|
|
473
|
+
Use these in OBS or your streaming app. Audio will play in the room once you start streaming.
|
|
474
|
+
</Text>
|
|
475
|
+
</View>
|
|
476
|
+
|
|
477
|
+
<TouchableOpacity
|
|
478
|
+
style={styles.regenerateBtn}
|
|
479
|
+
onPress={() => {
|
|
480
|
+
setStreamKey(null);
|
|
481
|
+
setRtmpUrl(null);
|
|
482
|
+
generateKey();
|
|
483
|
+
}}
|
|
484
|
+
disabled={generatingKey}
|
|
485
|
+
>
|
|
486
|
+
<MaterialCommunityIcons name="refresh" size={16} color={theme.colors.textSecondary} />
|
|
487
|
+
<Text style={[styles.regenerateText, { color: theme.colors.textSecondary }]}>
|
|
488
|
+
Regenerate key
|
|
489
|
+
</Text>
|
|
490
|
+
</TouchableOpacity>
|
|
491
|
+
</View>
|
|
492
|
+
)}
|
|
493
|
+
</View>
|
|
494
|
+
)}
|
|
495
|
+
|
|
496
|
+
<View style={styles.section}>
|
|
497
|
+
<Text style={[styles.sectionLabel, { color: theme.colors.textSecondary }]}>
|
|
498
|
+
Stream Info (optional)
|
|
499
|
+
</Text>
|
|
500
|
+
|
|
501
|
+
<TextInput
|
|
502
|
+
style={[styles.input, { backgroundColor: `${theme.colors.card}80`, borderColor: theme.colors.border, color: theme.colors.text }]}
|
|
503
|
+
placeholder="Title"
|
|
504
|
+
placeholderTextColor={theme.colors.textSecondary}
|
|
505
|
+
value={title}
|
|
506
|
+
onChangeText={setTitle}
|
|
507
|
+
maxLength={200}
|
|
508
|
+
/>
|
|
509
|
+
|
|
510
|
+
<TouchableOpacity
|
|
511
|
+
style={[styles.imagePicker, { backgroundColor: `${theme.colors.card}80`, borderColor: theme.colors.border }]}
|
|
512
|
+
onPress={handlePickImage}
|
|
513
|
+
disabled={uploadingImage}
|
|
514
|
+
>
|
|
515
|
+
{imagePreviewUri ? (
|
|
516
|
+
<Image source={{ uri: imagePreviewUri }} style={styles.imagePreview} />
|
|
517
|
+
) : (
|
|
518
|
+
<View style={styles.imagePickerPlaceholder}>
|
|
519
|
+
<MaterialCommunityIcons name="image" size={24} color={theme.colors.textSecondary} />
|
|
520
|
+
<Text style={[styles.imagePickerText, { color: theme.colors.textSecondary }]}>
|
|
521
|
+
Cover image
|
|
522
|
+
</Text>
|
|
523
|
+
</View>
|
|
524
|
+
)}
|
|
525
|
+
{uploadingImage && (
|
|
526
|
+
<View style={styles.imageOverlay}>
|
|
527
|
+
<ActivityIndicator size="small" color="#FFFFFF" />
|
|
528
|
+
</View>
|
|
529
|
+
)}
|
|
530
|
+
</TouchableOpacity>
|
|
531
|
+
|
|
532
|
+
<TextInput
|
|
533
|
+
style={[styles.input, styles.inputMultiline, { backgroundColor: `${theme.colors.card}80`, borderColor: theme.colors.border, color: theme.colors.text }]}
|
|
534
|
+
placeholder="Description"
|
|
535
|
+
placeholderTextColor={theme.colors.textSecondary}
|
|
536
|
+
value={description}
|
|
537
|
+
onChangeText={setDescription}
|
|
538
|
+
maxLength={500}
|
|
539
|
+
multiline
|
|
540
|
+
numberOfLines={2}
|
|
541
|
+
/>
|
|
542
|
+
</View>
|
|
543
|
+
|
|
544
|
+
<View style={styles.footer}>
|
|
545
|
+
{mode === 'url' && (
|
|
546
|
+
<TouchableOpacity
|
|
547
|
+
style={[
|
|
548
|
+
styles.startBtn,
|
|
549
|
+
{
|
|
550
|
+
backgroundColor: streamUrl.trim() ? theme.colors.primary : theme.colors.backgroundSecondary,
|
|
551
|
+
opacity: loading ? 0.6 : 1,
|
|
552
|
+
},
|
|
553
|
+
]}
|
|
554
|
+
onPress={isEditingUrlStream ? handleUpdateMetadata : handleStartUrlStream}
|
|
555
|
+
disabled={!streamUrl.trim() || loading}
|
|
556
|
+
>
|
|
557
|
+
{loading ? (
|
|
558
|
+
<ActivityIndicator size="small" color="#FFFFFF" />
|
|
559
|
+
) : isEditingUrlStream ? (
|
|
560
|
+
<MaterialCommunityIcons
|
|
561
|
+
name="content-save"
|
|
562
|
+
size={18}
|
|
563
|
+
color={streamUrl.trim() ? '#FFFFFF' : theme.colors.textSecondary}
|
|
564
|
+
/>
|
|
565
|
+
) : (
|
|
566
|
+
<MaterialCommunityIcons
|
|
567
|
+
name="play"
|
|
568
|
+
size={18}
|
|
569
|
+
color={streamUrl.trim() ? '#FFFFFF' : theme.colors.textSecondary}
|
|
570
|
+
/>
|
|
571
|
+
)}
|
|
572
|
+
<Text style={{ color: streamUrl.trim() ? '#FFFFFF' : theme.colors.textSecondary, fontWeight: '600', fontSize: 16 }}>
|
|
573
|
+
{isEditingUrlStream ? 'Save Stream Info' : 'Start Stream'}
|
|
574
|
+
</Text>
|
|
575
|
+
</TouchableOpacity>
|
|
576
|
+
)}
|
|
577
|
+
|
|
578
|
+
{mode === 'rtmp' && streamKey && (
|
|
579
|
+
<TouchableOpacity
|
|
580
|
+
style={[styles.startBtn, { backgroundColor: theme.colors.primary, opacity: loading ? 0.6 : 1 }]}
|
|
581
|
+
onPress={handleUpdateMetadata}
|
|
582
|
+
disabled={loading}
|
|
583
|
+
>
|
|
584
|
+
{loading ? (
|
|
585
|
+
<ActivityIndicator size="small" color="#FFFFFF" />
|
|
586
|
+
) : (
|
|
587
|
+
<MaterialCommunityIcons name="content-save" size={18} color="#FFFFFF" />
|
|
588
|
+
)}
|
|
589
|
+
<Text style={{ color: '#FFFFFF', fontWeight: '600', fontSize: 16 }}>
|
|
590
|
+
Save Stream Info
|
|
591
|
+
</Text>
|
|
592
|
+
</TouchableOpacity>
|
|
593
|
+
)}
|
|
594
|
+
</View>
|
|
595
|
+
</ScrollView>
|
|
596
|
+
)}
|
|
597
|
+
</View>
|
|
598
|
+
);
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
const styles = StyleSheet.create({
|
|
602
|
+
container: { flex: 1 },
|
|
603
|
+
scrollContent: { paddingBottom: 32 },
|
|
604
|
+
modeSelector: {
|
|
605
|
+
flexDirection: 'row',
|
|
606
|
+
gap: 10,
|
|
607
|
+
paddingHorizontal: 16,
|
|
608
|
+
paddingTop: 16,
|
|
609
|
+
paddingBottom: 8,
|
|
610
|
+
},
|
|
611
|
+
modeTab: {
|
|
612
|
+
flex: 1,
|
|
613
|
+
flexDirection: 'row',
|
|
614
|
+
alignItems: 'center',
|
|
615
|
+
justifyContent: 'center',
|
|
616
|
+
gap: 6,
|
|
617
|
+
paddingVertical: 10,
|
|
618
|
+
borderRadius: 10,
|
|
619
|
+
borderWidth: 1,
|
|
620
|
+
},
|
|
621
|
+
modeTabText: { fontSize: 14, fontWeight: '600' },
|
|
622
|
+
section: {
|
|
623
|
+
paddingHorizontal: 16,
|
|
624
|
+
paddingTop: 12,
|
|
625
|
+
gap: 10,
|
|
626
|
+
},
|
|
627
|
+
sectionLabel: {
|
|
628
|
+
fontSize: 13,
|
|
629
|
+
fontWeight: '600',
|
|
630
|
+
textTransform: 'uppercase',
|
|
631
|
+
letterSpacing: 0.5,
|
|
632
|
+
marginBottom: 2,
|
|
633
|
+
},
|
|
634
|
+
input: {
|
|
635
|
+
borderWidth: 1,
|
|
636
|
+
borderRadius: 10,
|
|
637
|
+
paddingHorizontal: 14,
|
|
638
|
+
paddingVertical: 12,
|
|
639
|
+
fontSize: 15,
|
|
640
|
+
},
|
|
641
|
+
inputMultiline: { minHeight: 60, textAlignVertical: 'top' },
|
|
642
|
+
imagePicker: {
|
|
643
|
+
borderWidth: 1,
|
|
644
|
+
borderRadius: 10,
|
|
645
|
+
overflow: 'hidden',
|
|
646
|
+
height: 100,
|
|
647
|
+
},
|
|
648
|
+
imagePreview: { width: '100%', height: '100%', resizeMode: 'cover' },
|
|
649
|
+
imagePickerPlaceholder: {
|
|
650
|
+
flex: 1,
|
|
651
|
+
alignItems: 'center',
|
|
652
|
+
justifyContent: 'center',
|
|
653
|
+
gap: 4,
|
|
654
|
+
},
|
|
655
|
+
imagePickerText: { fontSize: 13, fontWeight: '500' },
|
|
656
|
+
imageOverlay: {
|
|
657
|
+
...StyleSheet.absoluteFill,
|
|
658
|
+
backgroundColor: 'rgba(0,0,0,0.4)',
|
|
659
|
+
alignItems: 'center',
|
|
660
|
+
justifyContent: 'center',
|
|
661
|
+
},
|
|
662
|
+
generateBtn: {
|
|
663
|
+
flexDirection: 'row',
|
|
664
|
+
alignItems: 'center',
|
|
665
|
+
justifyContent: 'center',
|
|
666
|
+
gap: 8,
|
|
667
|
+
paddingVertical: 14,
|
|
668
|
+
borderRadius: 10,
|
|
669
|
+
},
|
|
670
|
+
generateBtnText: { color: '#FFFFFF', fontSize: 16, fontWeight: '600' },
|
|
671
|
+
loadingBox: {
|
|
672
|
+
alignItems: 'center',
|
|
673
|
+
justifyContent: 'center',
|
|
674
|
+
gap: 10,
|
|
675
|
+
paddingVertical: 24,
|
|
676
|
+
},
|
|
677
|
+
loadingText: { fontSize: 14 },
|
|
678
|
+
credentialsBox: { gap: 4 },
|
|
679
|
+
regenerateBtn: {
|
|
680
|
+
flexDirection: 'row',
|
|
681
|
+
alignItems: 'center',
|
|
682
|
+
justifyContent: 'center',
|
|
683
|
+
gap: 6,
|
|
684
|
+
marginTop: 12,
|
|
685
|
+
paddingVertical: 8,
|
|
686
|
+
},
|
|
687
|
+
regenerateText: { fontSize: 13, fontWeight: '500' },
|
|
688
|
+
credLabel: {
|
|
689
|
+
fontSize: 12,
|
|
690
|
+
fontWeight: '600',
|
|
691
|
+
textTransform: 'uppercase',
|
|
692
|
+
letterSpacing: 0.5,
|
|
693
|
+
},
|
|
694
|
+
credRow: {
|
|
695
|
+
flexDirection: 'row',
|
|
696
|
+
alignItems: 'center',
|
|
697
|
+
borderWidth: 1,
|
|
698
|
+
borderRadius: 10,
|
|
699
|
+
paddingLeft: 14,
|
|
700
|
+
paddingRight: 4,
|
|
701
|
+
paddingVertical: 4,
|
|
702
|
+
},
|
|
703
|
+
credValue: {
|
|
704
|
+
flex: 1,
|
|
705
|
+
fontSize: 13,
|
|
706
|
+
fontFamily: Platform.OS === 'ios' ? 'Menlo' : 'monospace',
|
|
707
|
+
},
|
|
708
|
+
copyBtn: { padding: 10 },
|
|
709
|
+
infoRow: {
|
|
710
|
+
flexDirection: 'row',
|
|
711
|
+
alignItems: 'flex-start',
|
|
712
|
+
gap: 6,
|
|
713
|
+
marginTop: 10,
|
|
714
|
+
},
|
|
715
|
+
infoText: { flex: 1, fontSize: 13, lineHeight: 18 },
|
|
716
|
+
footer: {
|
|
717
|
+
paddingHorizontal: 16,
|
|
718
|
+
paddingTop: 20,
|
|
719
|
+
paddingBottom: 40,
|
|
720
|
+
},
|
|
721
|
+
startBtn: {
|
|
722
|
+
flexDirection: 'row',
|
|
723
|
+
alignItems: 'center',
|
|
724
|
+
justifyContent: 'center',
|
|
725
|
+
gap: 8,
|
|
726
|
+
paddingVertical: 14,
|
|
727
|
+
borderRadius: 12,
|
|
728
|
+
},
|
|
729
|
+
});
|