I am using react-native-youtube-iframe in my react native mobile app and up until now I had no issues embedding youtube videos. We had iOS app released at first and just two months ago we released the android app, as well.Now, one user complained about not being able to watch the videos on the app. They got the message: Sign in to confirm you are not a bot. This is the screenshot they sent:
Here is part of my code using the library:
import YoutubePlayer from 'react-native-youtube-iframe';...<YoutubePlayer height={hProp || videoHeight} width={wProp || videoWidth} play={playing} videoId={videoYoutubeId} onChangeState={handleStateChange} ref={playerRef} onReady={handleReady} initialPlayerParams={{ rel: false, }}/>
This is how I am extracting the videoId from the youtube link (the youtube links are fetched from my database)
const videoYoutubeId = getSearchParamFromURL( video.youtubeLink,'v');
And this is the function:
export const getSearchParamFromURL = (url, param) => { const include = url.includes(param); if (!include) return null; const params = url.split(/([&,?,=])/); const index = params.indexOf(param); const value = params[index + 2]; return value;};
It is working for iOS devices and currently we have only one user that reported this issue on their android device.
I would really need to fix this issue, since users are subscribed and paying to watch videos on the app.