From 75702d823f0442ca22c518679781344c3e0ba987 Mon Sep 17 00:00:00 2001 From: tapframe Date: Thu, 8 Jan 2026 03:49:38 +0530 Subject: [PATCH] plugintest: added player testing support --- .../plugin-tester/IndividualTester.tsx | 110 +++++++++++++----- 1 file changed, 81 insertions(+), 29 deletions(-) diff --git a/src/screens/plugin-tester/IndividualTester.tsx b/src/screens/plugin-tester/IndividualTester.tsx index 36c9c16..f25f558 100644 --- a/src/screens/plugin-tester/IndividualTester.tsx +++ b/src/screens/plugin-tester/IndividualTester.tsx @@ -18,13 +18,14 @@ import { pluginService } from '../../services/pluginService'; import axios from 'axios'; import { getPluginTesterStyles, useIsLargeScreen } from './styles'; import { Header, MainTabBar } from './components'; +import type { RootStackNavigationProp } from '../../navigation/AppNavigator'; interface IndividualTesterProps { onSwitchTab: (tab: 'individual' | 'repo') => void; } export const IndividualTester = ({ onSwitchTab }: IndividualTesterProps) => { - const navigation = useNavigation(); + const navigation = useNavigation(); const insets = useSafeAreaInsets(); const { currentTheme } = useTheme(); const isLargeScreen = useIsLargeScreen(); @@ -563,42 +564,93 @@ export const IndividualTester = ({ onSwitchTab }: IndividualTesterProps) => { ); + const playStream = (stream: any) => { + if (!stream.url) { + Alert.alert('Error', 'No URL found for this stream'); + return; + } + + const playerRoute = Platform.OS === 'ios' ? 'PlayerIOS' : 'PlayerAndroid'; + const streamName = stream.name || stream.title || 'Test Stream'; + const quality = (stream.title?.match(/(\d+)p/) || stream.name?.match(/(\d+)p/) || [])[1] || undefined; + + // Build headers from stream object if present + const headers = stream.headers || stream.behaviorHints?.proxyHeaders?.request || {}; + + navigation.navigate(playerRoute as any, { + uri: stream.url, + title: `Plugin Tester - ${streamName}`, + streamName, + quality, + headers, + // Pass any additional stream properties + videoType: stream.videoType || undefined, + } as any); + }; + const renderResultsTab = () => ( - + {streams.length === 0 ? ( No streams found yet. ) : ( - streams.map((stream, i) => ( - - {stream.title || stream.name} - Quality: {stream.quality || 'Unknown'} - Size: {stream.description || 'Unknown'} - URL: {stream.url} - - - {(() => { - try { - return JSON.stringify(stream, null, 2); - } catch { - return String(stream); - } - })()} - + <> + + {streams.length} Stream{streams.length !== 1 ? 's' : ''} Found + Tap Play to test a stream in the native player. - )) + {streams.map((stream, i) => ( + playStream(stream)} + activeOpacity={0.7} + > + + + {stream.title || stream.name || 'Unnamed Stream'} + Quality: {stream.quality || (stream.title?.match(/(\d+)p/) || [])[1] || 'Unknown'} + {stream.description && Size: {stream.description}} + URL: {stream.url} + {stream.headers && Object.keys(stream.headers).length > 0 && ( + + Headers: {Object.keys(stream.headers).length} custom header(s) + + )} + + playStream(stream)} + > + + Play + + + + + {(() => { + try { + return JSON.stringify(stream, null, 2); + } catch { + return String(stream); + } + })()} + + + ))} + )} );