Why is the HTML audio tag inactive on my Norway website?

  • HTML/CSS
  • Thread starter Sam Groves
  • Start date
  • Tags
    Html
  • #1
Sam Groves
11
0
Hi.I am building up a site for Norway.So far I have this code:

HTML:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Norway's Home Page</title>
</head>
<body>
<p style="font-size:18;font-family:Verdana">
Norway (Bokmål: Norge, Nynorsk: Noreg), formally the Kingdom of Norway is a Nordic country in Northern Europe, situated on the Scandinavian Peninsula. The remote Arctic island of Jan Mayen and the archipelago of Svalbard also form part of Norway. Bouvet Island, located in the Subantarctic, is a dependency; Norway also claims the Antarctic territories of Peter I Island and Queen Maud Land. The capital and largest city in Norway is Oslo.
</p>
<p style="font-size:18;font-family:Verdana">
    Norway's flag
</p>
<p>
    <img src="Flag_of_Norway.png" width="512" height="256">

</p>
<p style="font-size:18;font-family:Verdana">
    Norway's national anthem
</p>
<p>
    <audio controls>

        <source src="url(https://commons.wikimedia.org/wiki/File:Norway_(National_Anthem).ogg)"  type="audio/ogg">    </audio>

</p></body>
</html>

But every time I simulate the website on a browser the audio element is inactive.Why?
 
Technology news on Phys.org
  • #3
Should I try download the file?
 
  • #4
Here you go:
HTML:
<audio controls="">
    <source src="https://upload.wikimedia.org/wikipedia/commons/f/f6/Norway_%28National_Anthem%29.ogg" type="audio/ogg">
</audio>

This is where the link to the audio file is (at the mouse pointer):

Screenshot_2023-12-27_15-15-42.png
 
  • Like
Likes jedishrfu and Greg Bernhardt
  • #5
jack action said:
This is where the link to the audio file is (at the mouse pointer):
Yes, but the OP will still need to have some app available to play the audio file.
 
  • #6
I tried OP's code on my desktop. I get the same problem: a disabled control.
I do have an app to play ogg files, so it's not that.

I tried a different file: https://en.wikipedia.org/wiki/File:Crescendo_example.ogg
Same problem, so it's not just the OP's chosen clip.

Then I tried this: https://upload.wikimedia.org/wikipedia/commons/e/e4/PSK31_sample.ogg
It works.

So the code is fine. Something about certain audio file(s) I guess (codex?)
Code:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Norway's Home Page</title>
</head>
<body>
...
<p style="font-size:18;font-family:Verdana">
    Norway's national anthem
</p>
<p>
    <audio controls>

        <source src="https://upload.wikimedia.org/wikipedia/commons/e/e4/PSK31_sample.ogg"  type="audio/ogg">
Your browser does not support the audio tag.

    </audio>

</p></body>
</html>
 
Last edited:
  • #7
P.S. To PF admin: the copy code button does not seem to work.
1703778267953.png
 
  • #8
Mark44 said:
Your code needs to specify an application that can play this file, I believe.
When I loaded the lined file in my browser, it asked me which app to use to play it.
 
  • #9
Well, somebody please try my code, above. It worked.
 
  • #10
DaveC426913 said:
I tried a different file: https://en.wikipedia.org/wiki/File:Crescendo_example.ogg
Same problem, so it's not just the OP's chosen clip.
Those files ("/wiki/File:[filename]") are HTML files about a particular file named [filename]. You can check with your favorite browser by selecting "View page source". The extension in [filename] is misleading: there are no extensions for the files in the wiki/ "directory" of Wikipedia.

Mark44 said:
Yes, but the OP will still need to have some app available to play the audio file.
The OGG audio format is supported by all browsers except Safari.
 
  • #11
jack action said:
Those files ("/wiki/File:[filename]") are HTML files about a particular file named [filename]. You can check with your favorite browser by selecting "View page source". The extension in [filename] is misleading: there are no extensions for the files in the wiki/ "directory" of Wikipedia.
Sure. That's why the first two I tried didn't work.

My code works with the third file because it doesn't have the File: bit in the filename . :wink:
 
  • #12
Post 2: Wikipedia returned error msg. "their are no pages that use this file"
got same result with Spaces replacing the underscores
with "-" replacing the underscores
with the parenthesis removed
with the whole parenthetical phrase removed

Post 4: copied the filename from the post and entered it in browser Address bar.
Returned a "File Not Found" error​

Post 6: Both files play audio when clicked.

Me thinks you are beating a dead horse there!

Cheers,
Tom
 
  • #13
Tom.G said:
Post 2: Wikipedia returned error msg. "their are no pages that use this file"
got same result with Spaces replacing the underscores​
with "-" replacing the underscores​
with the parenthesis removed​
with the whole parenthetical phrase removed​

Post 4: copied the filename from the post and entered it in browser Address bar.
Returned a "File Not Found" error​

Post 6: Both files play audio when clicked.

Me thinks you are beating a dead horse there!

Cheers,
Tom
I don't understand what you're telling us. Are you saying it can't be done?
 
  • #15
SUCCESS.
Just re-tried playing from the links in posts 1 and 4 and they played.
Must have copied too much or too little of the URLs in my earlier attempts.

(or maybe I can blame it on the gremlins lurking around)
 

FAQ: Why is the HTML audio tag inactive on my Norway website?

Why is the HTML audio tag inactive on my Norway website?

One possible reason for the HTML audio tag being inactive on your Norway website could be due to browser compatibility issues. Make sure that the audio file format is supported by all major browsers.

Can the server hosting the audio file be causing the HTML audio tag to be inactive on my Norway website?

Yes, the server hosting the audio file could be another reason for the HTML audio tag being inactive. Ensure that the server is properly configured to allow access to the audio file.

Could there be a problem with the code implementation of the HTML audio tag on my Norway website?

It is possible that there is an error in the code implementation of the HTML audio tag on your Norway website. Double-check the code to ensure that it is correctly written and properly placed within the HTML structure.

Is there a chance that the audio file itself is corrupt and causing the HTML audio tag to be inactive on my Norway website?

Yes, a corrupt audio file could be the reason for the HTML audio tag being inactive. Try using a different audio file to see if the issue persists.

Are there any browser settings or plugins that could be preventing the HTML audio tag from working on my Norway website?

Browser settings or plugins could potentially be blocking the HTML audio tag from functioning on your Norway website. Disable any plugins that may be interfering with the audio playback and check the browser settings to ensure that audio is allowed to play.

Back
Top