question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

audio play automatically on `src` change with unique URL but same audio when `autoPlay` is `false`

See original GitHub issue

https://github.com/lhz516/react-h5-audio-player/blob/b3497ed79c2c0f07cb31e6c8d314efc2a592138e/src/index.js#L328

In here, if src changes, audio gets played auto even we say autoPlay is false.

We should either add one more condition like ... && autoPlay or completely disable this feature. Otherwise, in some cases, audios get played all the time.

For example; I regularly update components and when components updated, links get refreshed. Audio is same but each time update made, there is an unique encoded URL for each audio. So, with default, even if i select to not play audio automatically, its get played by this library because of this condition.

I’ve removed this on my repository and point the package there. I can create PR for this, if you want.

Just let me know which path should we follow here:

  • a. adding one more condition
  • b. completely remove this line

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
lhz516commented, Jan 5, 2020

I re-considered this issue.

autoPlay actually means auto play when first time DOM is loaded, not means every time src changes.

So I added another prop autoPlayAfterSrcChange which defaults to true because most music players are like this behavior.

3reactions
gencercommented, Nov 2, 2019

Currently, I am using my own fork as;

"react-h5-audio-player": "https://github.com/gencer/react-h5-audio-player#master",

However, I will publish a npm package for this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Autoplay guide for media and Web Audio APIs
Automatically starting the playback of audio (or videos with audio tracks) immediately upon page load can be an unwelcome surprise to users.
Read more >
HTML embed autoplay="false", but still plays automatically
Find "Autoplay" and click the "Settings" button. In the dropdown change it to block audio and video. The default is just audio. Your...
Read more >
HTML audio autoplay Attribute - W3Schools
The autoplay attribute is a boolean attribute. When present, the audio will automatically start playing as soon as it can do so without...
Read more >
Audio or video element that plays automatically has a control ...
This rule applies to any audio or video element for which all the following are true: (autoplay) the element has an autoplay attribute...
Read more >
Autoplay policy in Chrome - Chrome Developers
# New behaviors · Muted autoplay is always allowed. · Autoplay with sound is allowed if: The user has interacted with the domain...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found