+ 6
How to insert mp3 to html on sololearn.
I want my page playing sounds. No code yet.
13 odpowiedzi
+ 5
不能。因為自動播放被灠用作廣告及其他不良目的,所以現代化的瀏覽器禁止autoplay。
autoplay is not allowed in modern browsers, to protect users from bad user experience.
https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide
AudioElement.play() 函數,必須,我重申,是必須,由一個滑鼠動作發動。(UserGesture)
+ 5
you cannot upload any media content directly to sololearn codeplay ground
First you need to upload it on Dropbox or somewhere to get link of that content and then paste the link on audio tag..
review this threads
https://www.sololearn.com/discuss/1054246/?ref=app
+ 2
<audio>
<source src="yourfile.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
+ 2
Scooby Thanks!
+ 2
在JavaScript裡,要有一個函數,用play()。
這個函數必須是mouse event callback。
示範 1:
https://code.sololearn.com/Wl23AIEG6SuZ/?ref=app
示範 2:
https://code.sololearn.com/WelW4JX7EYPD/?ref=app
+ 2
no, sololearn app doesn't have the file system authorization. You can use on html files of your own computer to reference audio files in C:\ though.
+ 1
Gabriel Ilie If I don't insert mp3 file can I play sounds by trans mp3 to some code and play it?
+ 1
Gordon 可以用自動播放嗎
+ 1
Gordon 感謝
+ 1
Gordon 那我可以用把mp3轉成某種編碼來實現在playground播放的功能嗎,我之前有看過有人好像把mp3轉成base64可以在playground上播放
0
88888
P
0
mp3也能在code playground的Web Code播放。
是不能自動播放,但是有按鍵(可以是document)的話,mp3也能播放。