When I play an audio file, it sends me back to previous page and plays the audio file in the background


#1

I am trying to play an audio from firebase storage this is the url
chat.audioPathUpload = https://firebasestorage.googleapis.com/xxxxxxxxx/o/voices%2Frecord-1524652133484.wav?alt=media&token=xxxxx-xxx-xxxx-xxxxxxxxx-xxxxxxxxxx
(replaced credentials with “x”)

in my imports :
import { Media, MediaObject } from ‘@ionic-native/media’;

in my constructor :
private media: Media,

I have a simple function :

playAudio(chat){
let audio = new Audio(chat.audioPathUpload);
audio.play();
}

The play button is shown in a message kinda like WhatsApp. When i hit play button it sends me back to previous page and play the audio in the background. How to resolve this issue? I do not want to go back to previous page. I wanna stay on it and play the file.