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

  • 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)
 

1. Why is the HTML audio tag not working on my website in Norway?

This issue could be related to copyright or licensing restrictions specific to Norway. Some audio content might be restricted due to local copyright laws, preventing playback on websites accessed within Norway.

2. Could browser compatibility be the reason the HTML audio tag isn't functioning?

Yes, browser compatibility could be an issue. Ensure that the website is being accessed through browsers that support the HTML5 audio tag, such as the latest versions of Chrome, Firefox, Safari, and Edge.

3. Are there any server-side settings that could disable the audio tag in specific regions like Norway?

Yes, server-side settings or geo-restrictions implemented on the server might be blocking audio content in specific regions, including Norway. Check your server configuration or CDN settings to verify if there are any regional restrictions applied.

4. Could the issue be related to the audio file format used in the HTML audio tag?

Possibly, if the audio format is not supported universally across all browsers, it might not play correctly. Use widely supported formats like MP3 or WAV, or provide multiple source files in different formats to ensure compatibility across all browsers.

5. What steps can I take to troubleshoot and resolve the inactive HTML audio tag on my website in Norway?

Start by checking the console in your web browser's developer tools for any error messages that could indicate what might be going wrong. Ensure that the audio file's URL is accessible and not blocked in Norway. Test with different browsers and devices to rule out compatibility issues, and consider using a fallback audio player if necessary.

Back
Top