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)
 
Back
Top