+ 2

I found this code from code playground, but it is lacking something, its not working, please help...

buzzer--https://code.sololearn.com/WhJzbvF2ggt1/?ref=app

4th Nov 2017, 12:38 PM
Jitesh Gupta
3 Answers
+ 6
This code cannot work in mobile environment: autoplay is not enabled without user action (or some JS workarounds tricks)... Anyway, the JS error displayed at loading is due to the attempt to access a non valid id element in the page (the <iframe> tag is probably expected to be the target, but had been disabled by putting many slashes ^^)... In desk/laptop environment, assuming you doesn't take care of the (non-blocking) error message and you wait the time of querying and loading the iframe content created through JS, each button will play the expected sound of hidden youtube video loaded in <iframe>s element... However, that's a hudge inneficient way to play sounds in web documents ;P
4th Nov 2017, 12:55 PM
visph
visph - avatar
+ 2
thanks @Visph, but it means in any way it can't be played in mobile?
4th Nov 2017, 12:57 PM
Jitesh Gupta
+ 2
In mobile, it cannot work by this way (embeded youtube videos in <iframe> element)... But you can play sounds by other ways, if that's your question (since they're not hosted at youtube), even it require more or less tricky JS skills ;)
4th Nov 2017, 1:01 PM
visph
visph - avatar