+ 2
Can I have I hand on this?
I have issues adding an audio to my code. The audio is saved on my device as Space.mp3 and precisely in /storage/download/Music. This was the code I generated for the <body> part. <body> <audio controls> <Source src="Space.mp3" type="audio/mpeg"> <Source src="Space.ogg" type="audio/ogg'> Audio element not supported by your browser. </audio> </body> But this only shows the audio image on the output page without being able to play. Is my code correct? Or is there any changes I need to make to avert this issue. Please rewrite the code if mine is wrong or has issues. Thanks and God bless😊
8 Respostas
+ 4
Second thing which many times happened with me, the documents must be inside the same folder. I have tried using relative path like `../../Picture/somePic.jpg` but it doesn't work. So, move your audio file to current dir as the next step to make thing correct according to me.
+ 3
First things first, audio element was introduced in HTML5. So, make sure your webpage/HTML document have doctype declaration <!DOCTYPE html> element at the very top of your document.
+ 3
tell me what works and what not
+ 3
lokesh
Yeah that's true, I've also tried external path but didn't work, the audio will work only if the all the current documents and medias are in the same folder.
+ 2
Cyber Nate thanks for understanding I thought it only happens with me. Maybe My code editor has set a path or some setting for that, cause for any file type there is a relative path or absolute path. But I just understood (or maybe not) that relative path of html is not same as linux filesystem navigation where we change dir, etc. Relative path in HTML is the other file relative to the current file and must be inside same dir. And absolute path can attach a file from the internet meaning from a website which is already hosted and working, ex: an image link from unsplash.
+ 2
Open Google Files app and click info or i button on your audio and copy the URL. This is a perfect URL for localhost ;)
+ 1
lokesh Thanks but what do you mean by current dir
+ 1
current directory in linux/folder in windows.