问题
Today, all of a sudden, I encountered the following error in our React application: HTTP Error 429. We implement Youtube links in the ReactPlayer and it appears this error means there are too many requests from our app to Youtube.
I tried working around the problem by using the iframe link for embedding Youtube videos, such as https://www.youtube.com/embed/tckGI4C7k10. This works well, with no error, but unfortunately, I am not able to access the current time or seekTo() on the player, since iframes are isolated (according to Getting Current YouTube Video Time). I want to be able to use seekTo() in order to navigate to different timestamps in the video, dynamically.
Other people seem to face the same issue, but without any clear solutions:
- https://support.google.com/youtube/thread/18653316?hl=en
- https://support.google.com/youtube/thread/21939228?hl=en.
Does anyone know how to solve this issue? Thanks.
EDIT:
The iframe I am using is the following.
<iframe
src={setupRef.current.content}
allowFullScreen
webkitallowfullscreen="true"
playsInline={true}
mozallowfullscreen="true"
allow="autoplay *; fullscreen *; encrypted-media *"
frameBorder="0"
style={{ width: "100%", height: "100%" }}
/>
I resolved the error by switching to another WIFI from the eduroam school WIFI I was on. But I will continue researching this by filing a support issue on Google since it should work everywhere.
来源:https://stackoverflow.com/questions/64700957/youtube-link-in-reactplayer-http-error-429