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

I cannot play video with playVideo() in iOS Webview. #379

Open
ParkDyel opened this issue Nov 8, 2022 · 2 comments
Open

I cannot play video with playVideo() in iOS Webview. #379

ParkDyel opened this issue Nov 8, 2022 · 2 comments

Comments

@ParkDyel
Copy link

ParkDyel commented Nov 8, 2022

I want to play Youtube video when be isIntersecting.

is working in iOS Safari, Android Webview, but not working in iOS Webview.
in iOS Webview, it seems to play and then immediately stop.

Has anyone experienced anything related?

code on Flutter Webview with React(18.1.9), react-youtube(10.0.0)

// YoutubePlayer.tsx
const onIntersect = useCallback(async ([entry] /*, observer */) => {
  if (entry.isIntersecting) {
    youtubeRef?.current?.internalPlayer?.playVideo();
    return;
  }
  youtubeRef?.current?.internalPlayer?.stopVideo();
}, []);

// ...

useEffect(() => {
  if (!opts || !onIntersect || !wrapperRef.current) {
    return;
  }
  const observer = new IntersectionObserver(onIntersect, {
    threshold: 0.5,
  });
  observer.observe(wrapperRef.current);
  return () => observer.disconnect();
}, [opts, onIntersect]);
@LauraPiccolo
Copy link

Did you resolve this?
I made to play them when mute is set to true but no way to play them unmuted ...

@karakauer
Copy link

I guess you can't do this if rely to official documentation

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

3 participants