I am building a website and there are some podcasts on it, which when user clicks play need to play. I've got some audio elements and most of them work but one in particular doesn't, even in JSFiddle.
I've been thinking about and googling stuff but I can't figure it out. When JavaScript executes the .play() command it just returns a promise that never resolves.
Here is the html:
<audio class="pid-player" href="https://www.amplifiedpodcast.com/wp-content/uploads/2019/10/01-Amplified3-Podcast_-Sean-Stein-Sm.mp3.mp3"></audio>
Here is the JavaScript:
console.log(document.querySelector('.pid-player').play());
When I open the audio href in a new tab it plays!
This is happening in Chrome and Firefox.
Any ideas appreciated!
"href" should be src
like this
<audio class="pid-player" src="https://www.amplifiedpodcast.com/wp-content/uploads/2019/10/01-Amplified3-Podcast_-Sean-Stein-Sm.mp3.mp3" controls></audio>