jquery - Play local video from code when dynamically change src Phonegap + javascript -


i'm have issue when im try play (.play()) javascript code video tag, i'm using phonegap , jquerymobile.

this videoplayer page.

<div data-role="page" id="page-reproduccion" data-theme="b">  <div data-role="content">   <video id="reproductor" autostart>   </video>  </div> </div> 

and method change src.

var videoplayer = $('#reproductor');    videoplayer.bind('loadeddata', function(){     console.log('datos cargados');   });    videoplayer.bind('ended', function(){     console.log('fin del video!');   });    videoplayer.bind('canplay',function() {     console.log("can play");   });    videoplayer.src = listavideos[indexvideo].ruta_local;   videoplayer[0].autoplay = true;   videoplayer[0].load();   videoplayer[0].play(); 

i need when change src, automatically autoplay video.

i put code in ways:

  videoplayer.bind('loadeddata', function(){     console.log('datos cargados');     videoplayer[0].load();     videoplayer[0].play();     }); 

or:

videoplayer.bind('canplay',function() {     console.log("can play");     videoplayer[0].load();     videoplayer[0].play();   }); 

but not works, have click play on video tag.

note: i'm put code in "onclick" event button , works. need autoplay without interaction user.

thanks.

this solution:

https://github.com/simplec-dev/androidmediagesturesetting/blob/99df9b5/readme.md

this plugin do:

setmediaplaybackrequiresusergesture(false) 

Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -