cancel
Showing results for 
Search instead for 
Did you mean: 

Embedded <audio/> in HTML page not working online.

FIXED
Highlighted
mpw
Newbie
Posts: 3
Registered: ‎05-08-2007

Embedded <audio/> in HTML page not working online.

Hello there

I've just added a simple audio file into a webpage hosted on my Plusnet webspace and while everything works well on my local machine but when I FTP (using Filezilla) the sound no longer works (on any browser). The total added code is

 

<iframe src="silence.mp3" allow="autoplay" id="audio" style="display:none"></iframe>

<audio id="player" autoplay>
<source src="duke.mp3" type="audio/mp3">
</audio>

 

The first part just allows Chrome to autoplay the next part.

Any thoughts on why it doesn't work when online would be gratefully received!

Thanks

Michael 

 

8 REPLIES 8
Community Veteran
Posts: 6,967
Thanks: 2,246
Fixes: 43
Registered: ‎16-10-2014

Re: Embedded <audio/> in HTML page not working online.

Hi @mpw Welcome to the Forums. It could be that the file can't be found so you might want to set the path of the mp3 file to

./duke.mp3

or provide it with a full path from the server root.

 

mpw
Newbie
Posts: 3
Registered: ‎05-08-2007

Re: Embedded <audio/> in HTML page not working online.

Hello there,

 

Thanks for the prompt reply!

I've checked and on both my local machine and also on my webspace that the files are just within the same single folder so I didn't think that I'd need a path.

Thanks

 

Michael

Community Veteran
Posts: 6,967
Thanks: 2,246
Fixes: 43
Registered: ‎16-10-2014

Re: Embedded <audio/> in HTML page not working online.

Fix

OK @mpw, but humour me if you will and prepend the file name with

./

Also remember that the server will no doubt be Unix so case is an issue as well, so duke.mp3 is not the same as Duke.mp3

mpw
Newbie
Posts: 3
Registered: ‎05-08-2007

Re: Embedded <audio/> in HTML page not working online.

Sir - you are a genius!!

Thank you so much for taking the time to help - I had upper case 'Duke' locally which worked fine but it was looking for lower case when it was online.

Thanks again for your assistance!

Regards

Michael

Community Veteran
Posts: 6,967
Thanks: 2,246
Fixes: 43
Registered: ‎16-10-2014

Re: Embedded <audio/> in HTML page not working online.

You are more than welcome @mpw, if you need any further assistance we're a friendly bunch here and only too willing to help.

Community Veteran
Posts: 14,690
Thanks: 849
Fixes: 12
Registered: ‎01-08-2007

Re: Embedded <audio/> in HTML page not working online.


@mpw wrote:

the files are just within the same single folder so I didn't think that I'd need a path.


You'd be surprised! File paths are a total menace at times and being a simple / boring thing not many pay much attention to them but the simple / and ./ can mean two big differences.

I need a new signature... i'm bored of the old one!
ChrisWoods
Grafter
Posts: 45
Thanks: 2
Fixes: 1
Registered: ‎11-08-2015

Re: Embedded <audio/> in HTML page not working online.

Just about all web servers run Linux, and Linux is case-sensitive. You could even have Duke.mp3 and duke.mp3 as different files. Only Windows is so carefree about filenames :-)

VileReynard
Champion
Posts: 11,840
Thanks: 454
Fixes: 17
Registered: ‎01-09-2007

Re: Embedded <audio/> in HTML page not working online.

Due to its DOS origins.

"In The Beginning Was The Word, And The Word Was Aardvark."