Problems with audio stream with certain phones


I’m having troubles with a “simple” radio app that I’m developing with Ionic.

I want to play a HTML audio stream in my app, but there’s no case with certain phones. I’ve tested with Galaxy S6, Galaxy Note 5, Galaxy S6 Edge, and an Xperia Z4, and there’s no audio, but when I test with the Emulator, or run the app with Geny Motion and other devices like Xperia M2, LG G3 or Alcatel Idol the sound works great!

Also, the app work great in iOS.

I’ve tested 3 ways:

First, I’ve tested this JS code inside the app:

var audioElement = document.createElement(‘video’);

audioElement.setAttribute(‘src’, ‘’);
audioElement.setAttribute(‘id’, ‘audio’);
audioElement.setAttribute(‘preload’, ‘auto’);
audioElement.setAttribute(‘autoplay’, ‘true’);

console.log(“Ready to play”);;

It works if I call; from another button, but it takes up to 15 seconds from loggin “Ready to play” in the console to actually playing, or it won’t start. It is kinda random.
If I press a play button calling, it works perfectly, after oncanplay triggers.

Secondlly, I’ve tested this other JS code:

var media = new Audio(“”);;
media.oncanplay = function(){;

Same result as before.

Finally, I’ve tested Cordova Plugin Media like this:

document.addEventListener(“deviceready”, onDeviceReady, false);
function onDeviceReady() {
function playAudio() {
// Create Media object from src
my_media = new Media(‘’, Success(), onError);
// Play audio;
// onSuccess Callback
function Success() {

  // onError Callback
  function onError(error) {
      console.log('code: ' + error.code + '\n' +
          'message: ' + error.message + '\n');


I obtain the same compatibility result, and also, when in the phones that it doesn’t work, it doesn’t log an error, but logs like it could load and play the source.

This is driving me crazy a little bit.