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.

Embed Youtube video autoplay not working

See original GitHub issue

Bug description: Youtube embedded player not working correctly in webview. Autoplay not working.

To Reproduce:

           <WebView
            mediaPlaybackRequiresUserAction={false}
            allowsInlineMediaPlayback={true}
// this prop makes autoplay right after loaded but its not allow go fullscreen since its embed for pc web not mobile if i understand it correctly
            //userAgent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36" 
            source={{
               uri: `https://www.youtube.com/embed/${video.id}?autoplay=1&modestbranding=1&playsinline=1`,
            }}
          />

Expected behavior: Autoplay right after video loaded in webview.

Screenshots/Videos: Example with prop userAgent: https://streamable.com/w43awn Example with expected behaviour but autoplay not working: https://streamable.com/qq57kj

Environment:

  • OS: iOS
  • OS version: 14.2
  • react-native version: 0.63.2
  • react-native-webview version:^11.0.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

4reactions
MrXyfircommented, Mar 1, 2021

Is there a user agent that fixes both issues?

Also if you don’t need fullscreen (of course it’d be nice to have…) you can disable the button by passing &fs=0 into the webview URL.

Edit: Instead of passing { uri } to source, pass in { html } and within your HTML use the JavaScript Iframe API to build your video player.

0reactions
RaviMopocommented, Jul 29, 2022

HI, I’m facing same issue any help?

Read more comments on GitHub >

github_iconTop Results From Across the Web

YouTube Autoplay does not work with iFrame
When you load the page Youtube need to search the video with you "list" parameter, then take the first video of you playlist...
Read more >
Autoplay not working on Embedded YouTube Video - YouTube
Are you trying to embed a youtube video in a web page and have it autoplay but its not working ? YouTube recently...
Read more >
Why does my YouTube video not autoplay?
First thing's first, make sure that autoplay is enabled when you're watching a video. This is simple enough to do, as the autoplay...
Read more >
YouTube AutoPlay Not Working | 8 Quick Fixes
YouTube AutoPlay Not Working; Fix 1: Enable the YouTube AutoPlay Feature; Fix 2: Clear the Cache and Data of the Browser; Fix 3:...
Read more >
Best Ways to Fix YouTube Autoplay Not Working
1. Toggle on/off AutoPlay & Log out Your YouTube Account · Launch the web browser and open the YouTube website. · Open any...
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