Html5 audio from url stops

Hi,

I created a mp3 player in my Ionic application. On brower it works fine, but when I build iOS application and install it on phone something strange happens. I click play button, audio isn’t playing, I pause the player, then play it again, one second of recoring playing and stops again, I pause player again and again press play, next second is playing. So I have to pause and play over and over again.

My audio player is crated in component property:

public audioPlayer: HTMLAudioElement = new Audio();

Audio source is loaded in ngOnInit:

this.audioPlayer.src = this.path;

Play and stop buttons trigger the following actions:

    play() {
        this.audioPlayer.play();
    }

    stop() {
        this.audioPlayer.pause();
    }

I tried with element controlled by code - the same result.
Audio is loaded from server, it’s mp3 and url uses htts://.

What can I do to make it play on first “play” button click?

I resolved the problem by switching to @ionic-native/media/ngx