Home > Technical & Creative Skills > Programming, Servers & Scripts

How to make sound for mobile landers? (11)


09-09-2015 05:20 PM #1 diltsi (Member)
How to make sound for mobile landers?

I tried Amy's "Skyrocket Your Lander CTR/CR with these Code Snippets" and it works great for desktop but not with mobile. Does anyone know a code which would work with mobile too?


09-09-2015 05:35 PM #2 beemarkt (Member)

I simply put the this code <audio autoplay> <source src="audio/beep1.mp3"/></audio> at the body part. And it works well....

Does not work on iOS.... Works on Android, etc


09-09-2015 05:47 PM #3 diltsi (Member)

Hmm I have it in body part too and it works great with desktop but not with my nexus 5 android phone. Could the amazon CDN be reason? And I want to emphasize that the desktop works fine.

Am I only one with this problem?


02-21-2016 05:06 PM #4 pablo (Member)

I´m having the same problem. My code is as follows:

<audio autoplay>
<source src="alert.ogg" type="audio/ogg">
<source src="alert.mp3" type="audio/mpeg">
</audio>

It works in desktop but not in android phones.


02-21-2016 05:19 PM #5 ysekse (Member)

<script>
var audio = new Audio("url1");
function playAudio() {
audio.play();
}

var audio2 = new Audio("url2");
function playAudio2() {
audio2.play();
}
</script>

Then call the play-function where-ever needed.
This works for me as far as I know. If you want to play it on load just write onload="playAudio(); alert('....')"


02-21-2016 06:56 PM #6 pablo (Member)

Still doesn´t work. The alert shows up, but the sound does not play:

Here´s how I do it:

<script>

var audio = new Audio("alert.mp3");
function playAudio() {
audio.play();
alert("Body loaded");
}
</script>
</head>
<body onload="playAudio()">


02-21-2016 07:50 PM #7 archieaff (Member)

Mobile phones do not support autoplay.


02-21-2016 09:14 PM #8 ysekse (Member)

@pablo
Can't really tell you exactly what's wrong, but try for example set onclick="playAudio()" for something, then tap it and see if it plays, if not find out why, and so on. Maybe try just audio and no alert, or timeout on alert and so on. Try all you can think of and maybe something will stick. Some other stuff you can try: other audio file, base64 the audio and put in the the src.

Good luck!


02-22-2016 06:50 PM #9 pablo (Member)

Thanks @ysekse! If I have new findings I´ll post them.
Regards,
Pablo.


04-22-2016 08:06 PM #10 pablo (Member)

Found an alternative:

Howler.js: http://goldfirestudios.com/blog/104/...script-Library

Works perfect in Android.

Regards,
Pablo.


04-22-2016 10:22 PM #11 exclusif (Member)

Have you noticed an increase in CTR with audio? Neither audio nor vibration did much for me. If anything it actually reduced CTR. Maybe I'm using the wrong sound. The only attention grabbing feature that have worked for me so far is the good ol' intro pop.


Home > Technical & Creative Skills > Programming, Servers & Scripts