Skip to content

Fullscreen android forces re-rendering #358

@dpoqramGTI

Description

@dpoqramGTI

Describe the bug
Pressing on fullscreen button forces re-rendering

WhatsApp.Video.2024-10-19.at.13.13.31.mp4

How can i solve this issue, it only happens on android,

Here is the code:

import React, { useState } from 'react';
import { View } from 'react-native';
import YoutubePlayer from 'react-native-youtube-iframe';

interface YoutubePlayerProps {
  mediaUrl: string;
}

const YoutubePlayerComponent: React.FC<YoutubePlayerProps> = ({ mediaUrl }) => {

  const getVideoId = (url: string): string => {
    const videoIdMatch = url.match(/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/);
    return videoIdMatch ? videoIdMatch[1] : '';
  };

  return (
    <View>
      <YoutubePlayer
        height={350}
        videoId={getVideoId(mediaUrl)}
        onError={(e) => console.error('Error loading video', e)}
      />
    </View>
  );
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions