So I am trying to add a HTML5 audio element which the user can respond to. When loaded, I have a full screen video that plays and then a audio file to go with the video. The video works, and the audio works, when set to autoplay. However, I would like the user to have that control upon loading. I have had the default HTML5 audio controls, but had no luck when clicking play.pause, nor is it working with adding buttons and a js onclick event. I followed W3Schools tutorial and they didnt even use a function for a onclick event. so I am starting to get lost here, do I need a function or is the audio element already capable of allowing users to interact. Please help.
ps. the hamburger nav bar is still a work in progress so dont mind the code.
Sorry but I dont understand why I need to change to video element. The video works fine, its the audio play/pause button on the Audio Controls element that isn’t working.
Ok, so the problem is your z-index, It is set to negative hence It not reachable as it is layered …set the z-index to the top most say z-index:1000 and your audio should work (even without javascript). Add the controls attribute to audio tag for pause/play button