Audio autoplay in JS
Hello.
How can I set autoplay in js?
I tried this, but it didn't work:
Code: Select all
var player = Appery('audioComponent');
player.attr('autoplay', 1);
Thanks!
Catch up wih the Appery.io community on our forum. Here you'll find information on the lastest questions and issues Appery.io developers are discussing.
https://forum.appery.io/
Hello.
How can I set autoplay in js?
I tried this, but it didn't work:
Code: Select all
var player = Appery('audioComponent');
player.attr('autoplay', 1);
Thanks!
player.play(); - doesn't work
Hello! Try preAppery("mobileaudio_6").get(0).play();
Appery("mobileaudio_6").get(0).pause();/prewhere mobileaudio_6 - audion component name
M-m-m... It didn't work.
Here is my code:
var player = Appery('audioComponent');
player.attr('src', value.filePath);
player.attr('type', 'audio/mpeg');
Code: Select all
player.get(0).play();
// Appery('audioComponent').get(0).play(); - not working
// Appery('audioComponent').play(); - not working
Music is playing, when I tap play btn on component.
1) Delete this line preplayer.attr('type', 'audio/mpeg');/pre2) There is no need to use additional variable, try this preAppery('audioComponent').attr('src', value.filePath);
Appery('audioComponent').get(0).play();/pre
Hello again.
H-m-m... Strange, but it didn't help. Here is my code:
Code: Select all
Appery('audioComponent').attr('src', value.filePath);
//if (value.autoplay === 1) {
Appery('audioComponent').get(0).play();
//}
Can I test autoplay it in browser or on mobile only? For now it is now playing nor in browser neighter on simulator or device.
Perhaps, I can get element with Tiggizi somehow?
Hi Ivan.
Where do you use your code (action, mapping, etc...)?
Could you please clarify (or send us few screenshots).
BTW you can use jplayer instead of audio component.
See http://jplayer.org/