setSrc not working to fix broken audio player

I have an audio player that gets initialized on my WordPress page. Unfortunately, sometimes the audio url is not valid (maybe even blank). I tried fixing it by calling mejs.players[0].setSrc('working.mp3'); but it is throwing TypeError: this.media.setSrc is not a function

I tried setting the media.src then load(), but that didn't work either. It has made a div with class 'me-cannotplay'. Does this mean that this player cannot be used?

Any way to still use this player?

Answers


You would need to add "flashmediaelement.swf"


Try

<audio id="player" controls="controls">
    <source type="audio/mp3" src=""/>
</audio>

Need Your Help

dynamically authenticate to google calender using php api Using OAuth 2.0

php curl google-api google-api-php-client

we want to fetch data from google calender and insert data through external api source.