-
-
Notifications
You must be signed in to change notification settings - Fork 72
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
intermittently hitting YouTubePlayerKit.YouTubePlayer.Error.embeddedVideoPlayingNotAllowed error #74
Comments
Hi @lundjordan, Thanks for your detailed description. But from looking at the provided code snippet I would recommend to annotate the YouTubePlayer instance variable with an struct YoutubePlayerHelperView: View {
@StateObject
var youTubePlayer: YouTubePlayer
....
} Additionally, as you app is showing multiple YouTubePlayerViews please keep in mind that simultaneous playback of multiple YouTube players is not supported (Read more) |
Thank you for the prompt reply! 🙏🏼
Interesting, in my case I can rule this out as the same video works most of the time and then once in a while, will failed to load with that error
Thanks, I will try that.
Got it. I would actually be interested in not having the youtube videos autoplay but I have a conundrum. I have the videos in a ScrollView and need the user to be able to scroll horizontally across them all. If I don't
this allows me to autoplay the video, set This might be scope creep of the bug but do you know of a way or support ability to use YoutubePlayer inside a scrollview and be able to scroll when touching inside the video frame? I bet you this would address the error issue as videos would only load/play as needed. I'll upload an example of how it works right now: Simulator.Screen.Recording.-.iPhone.15.Pro.-.2023-09-28.at.11.35.59.mp4 |
This is certainly kind a tricky as the underlying view of the PS: Thanks for the sponsoring 🙏 |
I am currently experiencing a simular issue. Not sure if it's the same My ideal use case would be to listen to the |
@tyler-fp a dedicated For now you can simply re-apply the current configuration which destroys the underlying JavaScript YouTubePlayer instance and performs a re-setup. extension YouTubePlayer {
func reload() {
self.update(configuration: self.configuration)
}
} |
Ah perfect! Simple enough, thanks @SvenTiigi 👍 |
Hi there, I started poking this a bit again as some users have complained. Below is my ugly attempt to reload: My youtube player view:
my view init call:
behaviour I get:
Any helps or tips would be appreciated! |
I ended up doing:
which is not pretty but it does work at least. I noticed sleeping for 1 second was not enough. Needed to up it to 2 seconds. |
Hi @lundjordan, Based on the code snippets you provided I can give you some tips which might be helpful.
struct YoutubePlayerHelperView: View {
@StateObject
var youTubePlayer: YouTubePlayer
var body: some View {
YouTubePlayerView(self.youTubePlayer) { state in
// ...
}
.onReceive(self.youTubePlayer.statePublisher) { state in
if case .error(let error) = state {
// TODO: Try to reload if necessary
}
}
}
}
|
Ah, |
and thanks for the context with 2. and 3. |
Closing this issue due to inactivity. |
What happened?
Hi,
First, thank you for this library. It's amazing.
I am intermittently hitting a embeddedVideoPlayingNotAllowed error. Maybe 1 out of 10 times when trying to load a youtube video.
We use mostly in-house videos but sometimes use youtube videos for our fitness app. They are in a horizontal scrollview.
Code snippets below
player view:
called here:
from main view:
here's a screenshot of it in use (when working). you can see the youtube video in bottom left corner.
thanks in advance!
What are the steps to reproduce?
described above
What is the expected behavior?
described above
The text was updated successfully, but these errors were encountered: