Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fullscreen android forces re-rendering #358

Open
dpoqramGTI opened this issue Oct 19, 2024 · 0 comments
Open

Fullscreen android forces re-rendering #358

dpoqramGTI opened this issue Oct 19, 2024 · 0 comments

Comments

@dpoqramGTI
Copy link

dpoqramGTI commented Oct 19, 2024

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>
  );
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant