Open mysticflute opened 1 month ago
possibly caused by this line: https://github.com/lhz516/react-h5-audio-player/blob/acec82a0d60b9bbba8348e9d49cdc2786ba9d79e/src/index.tsx#L207
maybe a fix would be to change this to check that src
is truthy or children
is not empty?
Describe the bug
<audio>
tags support multiple<source>
tags as children, instead of using thesrc
property, as demonstrated here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio#usage_notesThe reason for doing this is to provide different file types and let the browser determine the best source.
While the
src
prop is marked as optional for the React component, it doesn't seem to be able to actually play the audio if it's not specified. It might be because there is code checking that thesrc
property is defined before invoking the play method on the underlying audio tag.Environment
Package version: 3.9.1 React version: Browser and its version: OS and its version: