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

  • Context: HTML/CSS 
  • Thread starter Thread starter Sam Groves
  • Start date Start date
  • Tags Tags
    Html
Click For Summary

Discussion Overview

The discussion revolves around the issue of an inactive HTML audio tag on a website being developed for Norway. Participants explore potential reasons for the audio element not functioning as expected, including file source issues and browser compatibility.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Experimental/applied

Main Points Raised

  • One participant points out that the hyperlink in the original code leads to a Wiki Commons page rather than directly to the audio file, suggesting a need for a proper file URL.
  • Another participant proposes downloading the audio file directly to resolve the issue.
  • A different participant shares a working audio tag with a corrected file URL, indicating that the original code may have been incorrect.
  • Some participants note that the audio control remains inactive even when using different audio files, suggesting that the problem may relate to specific audio file formats or codecs.
  • There is mention that the OGG audio format is generally supported by most browsers except Safari, which could affect playback.
  • Several participants discuss the misleading nature of file extensions on Wikipedia, indicating that certain URLs do not lead to playable audio files.
  • One participant successfully plays audio from the links provided in the discussion, indicating that the issue may have been related to copying errors in earlier attempts.

Areas of Agreement / Disagreement

Participants express multiple competing views regarding the source of the problem, with no consensus on a single solution. Some believe the issue lies with the file URLs, while others suggest it may be related to browser compatibility or specific audio formats.

Contextual Notes

There are unresolved issues regarding the correct formatting of audio file URLs and the potential impact of browser compatibility on audio playback.

Sam Groves
Messages
11
Reaction score
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
Should I try download the file?
 
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   Reactions: jedishrfu and Greg Bernhardt
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.
 
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:
P.S. To PF admin: the copy code button does not seem to work.
1703778267953.png
 
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.
 
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)