question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Autoplay does not work upon videoId changes

See original GitHub issue

Describe the bug

If videoId is changed after the first render of YoutubePlayer, the video will not autoplay despite play prop being true

To Reproduce

https://snack.expo.dev/zeiphINXa

Steps to reproduce the behavior:

  1. Click Toggle Render -> see that video is autoplayed.
  2. Click Switch video -> video is no longer played
  3. Click Toggle Render twice to unmount and remount component -> video is autoplayed

Expected behavior

Video should always be played or paused based on the play prop

I tested this on both Expo and bare React Native project.

Smartphone (Expo):

  • Device: n/a
  • OS + version: Android/iOS
  • react-native-youtube-iframe version 11.6.2
  • react-native-webview version ^2.1.1
  • Expo version 42.0.0

Smartphone (Bare):

  • Device: Poco X3 Pro
  • OS + version: Android 11
  • react-native-youtube-iframe version 11.6.2
  • react-native-webview version ^2.1.1
  • Expo version 42.0.0

Thank you.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
hoangvvocommented, Aug 21, 2021

@LonelyCpp I can confirm that the new version works! I will try to put together a PR some time soon for the discussed refactor though.

Thanks for the work!

0reactions
LonelyCppcommented, Nov 17, 2021

@vishwadeepghimirezph this was published with v2.2.0

try it out and let me know

Read more comments on GitHub >

github_iconTop Results From Across the Web

Video auto play is not working in Safari and Chrome desktop ...
I had this issue in Safari 11 where a background video (no audio) wouldn't play automatically. Adding muted and autoplay did the trick....
Read more >
Fix HTML Video Autoplay Not Working - PQINA
You've added a video tag to your website, set the video source, but it won't autoplay. Let's fix it.
Read more >
How to Fix Windows 10 AutoPlay Not Working? – 6 Methods
Sometimes, Windows 10 AutoPlay may not work. How to fix windows 10 autoplay not working issue? This video offers 6 methods. Method 1....
Read more >
Video issues (autoplay not working, video player looks different)
In this article Video autoplay handling Autoplay test Video slider and Slider autoplay Video doesn't look the way it should be Can't swipe ......
Read more >
[Problem Solved!] Windows 10 AutoPlay Not Working - MiniTool
Open Control Panel. · Click AutoPlay. · Scroll down to the bottom of the AutoPlay settings interface and click the Reset all defaults...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found