Howler.js no longer works on Android

Please, can someone help me?

Howler had worked very well, but without any changes in my code, it stopped working on Android devices.
It works on web browser version.
On Android, now it is mute.

I’ve had problems using any version o howler (2.2.4, 2.2.3, …), and @types/howler many versions.

It seems to be a new restriction applied by Google.

import { Howl } from 'howler';

  play() {
    const url="assets/somefile.mp3";
    const sound = new Howl({
        src: [url],
        preload: true,
        volume: 0.5,
        format: ['mp3'],
        onloaderror: (id:any, msg:any) => {
          console.error(id, String(msg));
        },
        onplayerror: (id:any, msg:any) => {
          console.error(id, String(msg));
        },
        onend: () => {
          console.log("player end")
        }
    });
    sound.play();
  }

The steps to build a sample:
ionic start audioplayer blank --capacitor --type=angular

The build and install process:
ionic build; ionic cap copy android; cd android; ./gradlew clean; ./gradlew build; ./gradlew assembleDebug; ./gradlew installDebug;

If you unmute it via Howler’s controls does it work?

Are you auto playing the audio file without user interaction?

What brings you to this conclusion? Any references?

Hi, thanks for the reply.

I’m using a button on the html to play the mp3:

<ion-button color="medium" (click)="play()"><ion-icon name="arrow-back-circle-outline"></ion-icon></ion-button>

I changed the volume using the appropriated method and the sound is still mute.

    sound.volume(1); //--> 1 is the maximum volume
    console.log(sound.mute); //--> the result is false
    sound.play();

Ok, it doesn’t seems to be a problem originated by some restriction by Google anymore, I tested using sound manager 2 library and it works, but I’d like to still using howler if possible.

I found the solution, now it is needed to add explicitly the option html5:

    const sound = new Howl({
        src: [url],
        html5: true,
        format: ['mp3']
    });
    sound.play();
1 Like