Embed Youtube video on WordPress Website with AutoPlay in mobile

  • Post author:
  • Post last modified:April 21, 2022
  • Reading time:4 mins read
Autoplay YouTube Video In Mobile Live Practice

Hello friends, In this article, you will know, How to AutoPlay YouTube Video in Mobile (Android & IOS) & How to Increase YouTube Videos Views in Hindi.

Here is the simple code to post on your website where you want to add your youTube video. If you have confused to complete this work.

Below I have shared a detailed video that how to do this work. After this code, you will get a video to watch it.

<!-- 1. The <iframe> (video player) will replace this <div> tag. -->
<div class="iframe-container">
  <div id="player"></div>
  // 2. This code loads the IFrame Player API code asynchronously.
  var tag = document.createElement('script');

  tag.src = "https://www.youtube.com/iframe_api";
  var firstScriptTag = document.getElementsByTagName('script')[0];
  firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

  // 3. This function creates an <iframe> (and YouTube player)
  //    after the API code downloads.
  var player;
  function onYouTubeIframeAPIReady() {
    player = new YT.Player('player', {
      width: '100%',
      videoId: 'qIjxPxh78aU',
      playerVars: { 'autoplay': 1, 'playsinline': 1 },
      events: {
        'onReady': onPlayerReady

  // 4. The API will call this function when the video player is ready.
  function onPlayerReady(event) {

/* Make the youtube video responsive */
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    height: 0;
  .iframe-container iframe{
    position: absolute;
    left: 0;
    width: 100%;
    height: 100%;

Autoplay YouTube Video in Mobile Live Practice.

Below is an example of my work

Useful Tools & Website for Bloggers:-

Surjeet Verma

Hi, guys. Welcome to HDM (Host Digital Marketing). My name is Surjeet Verma, intermediate Digital Marketer, YouTuber, & Blogger. Happy to announce to you that I am the founder of hostdigitalmarketing.com. I am on a MISSION to share my knowledge with everyone and help them to learn Digital Marketing skills in a practical way.

Leave a Reply

+ 88 = 90

This site uses Akismet to reduce spam. Learn how your comment data is processed.