mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-01-11 20:10:25 +00:00
Enhance VideoPlayer and PlayerControls components with streamName support
This update adds the streamName prop to the VideoPlayer and PlayerControls components, allowing for better display of stream information. The AppNavigator has been modified to include streamName in the navigation parameters, and the StreamsScreen now determines the streamName based on the selected stream, improving the overall user experience by providing clearer context during playback.
This commit is contained in:
parent
d5f71ecb62
commit
89702d14f5
4 changed files with 12 additions and 2 deletions
|
|
@ -44,6 +44,7 @@ const VideoPlayer: React.FC = () => {
|
|||
quality,
|
||||
year,
|
||||
streamProvider,
|
||||
streamName,
|
||||
id,
|
||||
type,
|
||||
episodeId,
|
||||
|
|
@ -121,7 +122,7 @@ const VideoPlayer: React.FC = () => {
|
|||
const [pendingSeek, setPendingSeek] = useState<{ position: number; shouldPlay: boolean } | null>(null);
|
||||
const [currentQuality, setCurrentQuality] = useState<string | undefined>(quality);
|
||||
const [currentStreamProvider, setCurrentStreamProvider] = useState<string | undefined>(streamProvider);
|
||||
const [currentStreamName, setCurrentStreamName] = useState<string | undefined>(undefined);
|
||||
const [currentStreamName, setCurrentStreamName] = useState<string | undefined>(streamName);
|
||||
const isMounted = useRef(true);
|
||||
|
||||
const calculateVideoStyles = (videoWidth: number, videoHeight: number, screenWidth: number, screenHeight: number) => {
|
||||
|
|
@ -1000,6 +1001,7 @@ const VideoPlayer: React.FC = () => {
|
|||
quality={currentQuality || quality}
|
||||
year={year}
|
||||
streamProvider={currentStreamProvider || streamProvider}
|
||||
streamName={currentStreamName}
|
||||
currentTime={currentTime}
|
||||
duration={duration}
|
||||
playbackSpeed={playbackSpeed}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ interface PlayerControlsProps {
|
|||
quality?: string;
|
||||
year?: number;
|
||||
streamProvider?: string;
|
||||
streamName?: string;
|
||||
currentTime: number;
|
||||
duration: number;
|
||||
playbackSpeed: number;
|
||||
|
|
@ -51,6 +52,7 @@ export const PlayerControls: React.FC<PlayerControlsProps> = ({
|
|||
quality,
|
||||
year,
|
||||
streamProvider,
|
||||
streamName,
|
||||
currentTime,
|
||||
duration,
|
||||
playbackSpeed,
|
||||
|
|
@ -142,7 +144,7 @@ export const PlayerControls: React.FC<PlayerControlsProps> = ({
|
|||
<View style={styles.metadataRow}>
|
||||
{year && <Text style={styles.metadataText}>{year}</Text>}
|
||||
{quality && <View style={styles.qualityBadge}><Text style={styles.qualityText}>{quality}</Text></View>}
|
||||
{streamProvider && <Text style={styles.providerText}>via {streamProvider}</Text>}
|
||||
{streamName && <Text style={styles.providerText}>via {streamName}</Text>}
|
||||
</View>
|
||||
</View>
|
||||
<TouchableOpacity style={styles.closeButton} onPress={handleClose}>
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ export type RootStackParamList = {
|
|||
quality?: string;
|
||||
year?: number;
|
||||
streamProvider?: string;
|
||||
streamName?: string;
|
||||
id?: string;
|
||||
type?: string;
|
||||
episodeId?: string;
|
||||
|
|
|
|||
|
|
@ -522,6 +522,10 @@ export const StreamsScreen = () => {
|
|||
// Prepare available streams for the change source feature
|
||||
const streamsToPass = type === 'series' ? episodeStreams : groupedStreams;
|
||||
|
||||
// Determine the stream name using the same logic as StreamCard
|
||||
const isHDRezka = stream.name === 'HDRezka';
|
||||
const streamName = isHDRezka ? `HDRezka ${stream.title}` : (stream.name || stream.title || 'Unnamed Stream');
|
||||
|
||||
navigation.navigate('Player', {
|
||||
uri: stream.url,
|
||||
title: metadata?.name || '',
|
||||
|
|
@ -531,6 +535,7 @@ export const StreamsScreen = () => {
|
|||
quality: stream.title?.match(/(\d+)p/)?.[1] || undefined,
|
||||
year: metadata?.year,
|
||||
streamProvider: stream.name,
|
||||
streamName: streamName,
|
||||
id,
|
||||
type,
|
||||
episodeId: type === 'series' && selectedEpisode ? selectedEpisode : undefined,
|
||||
|
|
|
|||
Loading…
Reference in a new issue