Use video as a background in ionic/cordova for ios

后端 未结 2 1506
野性不改
野性不改 2021-02-02 04:25

I\'m needing to play like 6 videos as background in differents divs at the same time, but in IOS and ANDROID platforms. I\'m developing an ionic app.

I\'ve found a solut

相关标签:
2条回答
  • 2021-02-02 05:05

    So for this issue as used 2 things.

    First one, on config.xml added the next line

    <preference name="AllowInlineMediaPlayback" value="true"/>
    

    And after add the webkit-playsinline directive inside the video tag like this:

    <video controls preload="auto" webkit-playsinline><source src="videos/video_file.mp4"></video>
    

    And it works like a charm.

    0 讨论(0)
  • 2021-02-02 05:26

    Please note that the above answer is correct, except for the fact that with recent iOS updates to the video tag, the video must also have the muted property set to true in order to allow autoplay without user gesture.

    <video controls preload="auto" autoplay playsinline muted loop><source src="videos/video_file.mp4"></video>
    

    I spent all of last night trying to figure this one out, and I hope that this helps someone else out there.

    0 讨论(0)
提交回复
热议问题