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.

WebView Not Respecting video tag "playsinline" attribute

See original GitHub issue

Bug Report

Problem

What is expected to happen?

When a video tag contains the playsinline attribute I expect the video to be played in the confines of the webview

What does actually happen?

The video is being rendered in a native full screen viewer.

Information

Command or Code

Create a Cordova app that has the following video tag in the webview:

<video id="video-player" autoplay playsinline controls src="https://file-examples-com.github.io/uploads/2017/04/file_example_MP4_480_1_5MG.mp4"/>

When you start the cordova app you will see the video played full screen.

The same tag served to a Safari Browser behaves properly and doesn’t render it full screen.

Environment, Platform, Device

Running on iPad (MLMP2LL/A) with iOS 15.0

Version information

Cordova ios platform: 6.2.0

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • [x ] I included all the necessary information above

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
homerlexcommented, Sep 23, 2021

@breautek - Perfect! That did the trick. Thanks so much for the quick response.

0reactions
trockercommented, Sep 8, 2022

I have same issue. I’ve added in my config.xml. it’still not working. Any way to solve this issue???

For me, the code magically started to work on it’s own. Currently I have the following line under “<platform name="ios">” <preference name="AllowInlineMediaPlayback" value="true" />

Before this config started to work by itself, I remember doing the following as a stop-gap:

1. Search for other instances with the following command - grep -nir AllowInlineMediaPlayback *
2. platforms/ios/cordova/defaults.xml:25:    <preference name="AllowInlineMediaPlayback" value="false" />

Change the file in step 2 to say true instead of false. You might need to do this every time you add ios platform.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can i force playsinline for all <video> content
I have added the 'playsinline' attribute after the HTML page is fully loaded there is no issue with that and it works okay....
Read more >
iOS: using <video> doesn't respect playsinline and when ...
Started a brand new ionic project and added this plugin. added this video code. <video width="300" controls playsinline muted ...
Read more >
allowsInlineMediaPlayback not being respected in iOS 10 ...
We have a problem with iOS 10 Beta 5 and 6 (not sure about prior) where the allowsInlineMediaPlayback property is not being respected....
Read more >
playsinline not being respected on iOS
We have an HTML video element included in our index.html file which has a source that is dynamically loaded based on various triggers...
Read more >
The Video Embed element - HTML - MDN Web Docs - Mozilla
A Boolean attribute indicating that the video is to be played "inline", that is within the element's playback area. Note that the absence...
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