13 ответов
+ 5
Did you notice the error message when the script runs? automatic media playback is not supported without page viewer's consent. Media playback without page viewer's consent is seen as a privacy violation because it takes away page viewers' freedom to decide whether they want auto media playback. There are workarounds people wrote earlier in the past, as I recall, but you need to browse the Code section to find those examples. + Media autoplay guide https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide (Edit) You asked about this earlier. To help reduce duplicate questions, please choose only one of the posts and undo the duplicate. https://www.sololearn.com/Discuss/3216784/?ref=app
26th May 2023, 2:47 PM
Ipang
+ 5
Leonard Pls fix the question first: 1. Explain what the code should do 2. Explain the problem 3. Remove the "Fix this" part - this section is for you to get help, but not for other people to write code for you
26th May 2023, 2:04 PM
Emerson Prado
Emerson Prado - avatar
+ 3
zain Shendy My respond was for Leonard - the OP (Original Poster), not you ...
26th May 2023, 2:58 PM
Ipang
+ 3
zain Shendy Pls avoid giving finished code as answer, because it makes the OP skip the most important part of learning, and encourage the Bad Habit of asking others to solve one's tasks. Prefer giving hints for the OP to find the solution instead. Pls also avoid several sparse comments with little or no information. That makes everyone else's experience worse. Try to pack related thougths in a single comment.
26th May 2023, 11:35 PM
Emerson Prado
Emerson Prado - avatar
0
https://code.sololearn.com/Wd5JnhVIEuQx/?ref=app Here is the solution The play() function is only for the user selection, you need to create a button element and give it an id name and say like what i did
26th May 2023, 2:41 PM
zain Shendy
0
Hope this help
26th May 2023, 2:41 PM
zain Shendy
0
Huh?
26th May 2023, 2:48 PM
zain Shendy
0
So my code is wrong?
26th May 2023, 2:48 PM
zain Shendy
0
How?
26th May 2023, 2:48 PM
zain Shendy
0
Run my code solution
26th May 2023, 2:48 PM
zain Shendy
0
Tap on start button and the audio well work
26th May 2023, 2:49 PM
zain Shendy
0
He says play() is initiated by user guesture
26th May 2023, 2:52 PM
zain Shendy
0
?
26th May 2023, 2:58 PM
zain Shendy