Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49247

Play .mp3 if .wav file is not found

$
0
0

@neverender24 wrote:

I have some audio assets combined with mp3 and wav file. I have an application that loops through the data name and just combine it with the extension and get the source of the audio based on the name like the code below. My problem is that it only get the .wav file.

setTimeout( () => {

      this.audio.src = '../assets/audio/'+this.type+'/'+voice+'.wav';

      if (!this.audio.src) {
        this.audio.src = '../assets/audio/'+this.type+'/'+voice+'.mp3';
      }
      
      this.audio.play();
    }, 400);

What will I do to play the .mp3 if the .wav is not found?

Currently my code is not working.

Posts: 5

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 49247

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>