javascript - Dynamic HTML audio not loading/playing in Android browsers -
i trying load audios dynamically in project. i've used jplayer, mediaelement.js , javascript create audio element. working fine in desktop browser fails in android(os 4.1+) browsers except firefox. i've attached codes of various player tried.
jplayer:
$("#jquery_jplayer_1").jplayer({ ready: function (event) { $(this).jplayer("setmedia", { mp3: "sample.mp3", oga: "sample.ogg" }).jplayer("play"); }, swfpath: "js", supplied: "mp3, oga", wmode: "window", smoothplaybar: true, keyenabled: true, ended : function(){ //$(this).jplayer("stop" ); //$(this).jplayer("playhead",100); if(pcnt != tocarr.length-1){ $("#nextins").css("display","block"); } } });
mediaelement.js:
audioplayer = new mediaelementplayer("#player", { pauseotherplayers: false, success: function (mediaelement) { var sources = [{ src: "sample.mp3" }]; mediaelement.setsrc("sample.mp3"); mediaelement.pause(); mediaelement.load(); //mediaelement.play(); } });
javascript:
i have added audio tag in html page , added below code in js
js:
audioelement = document.getelementbyid('player'); audioelement.pause(); audioelement.setattribute('src', 'sample.mp3'); audioelement.load(); audioelement.play();
i don't know going wrong. please guide me on this.
Comments
Post a Comment