Search code examples
javascriptjqueryyoutube-apidropboxdropbox-api

Even after autoplay="false" preload="none", Video is starting without clicking on play button


In following Code, autoplay="false" preload="none" set but still Video is auto playing.

Where is the problem?

What I am missing?

new_video = document.createElement('video');
new_video.setAttribute('controls','true');
//new_video.setAttribute('autoBuffering','true');
new_video.setAttribute('preload','none');//autoPlay: false, 'preload':'auto'
new_video.setAttribute('autoPlay','false');
//new_video.setAttribute('type','video/mp4;codecs="vp8, vorbis"');
video = document.getElementById('RIZfC358yRk').appendChild(new_video);
source = document.createElement('source');  
source.setAttribute('src','https://dl.dropboxusercontent.com/u/87532981/Ella%20May%20and%20the%20Wishing%20Stone%20By%20Cary%20Fagan.mp4');
video.appendChild(source);
video.load();
video.play();

Solution

  • Try to use "autostart" attribute instead of "autoPlay":

    new_video.setAttribute('autostart','false');
    

    And remove the last line,

    video.play();