Is it possible to open a sound file? #22174
-
First, some context: I am a complete newb w.r.t. Git-anything, and not a programmer. I am trying to port some plain vanilla HTML pages (from a dead server), which contain stuff like this: You can hear this in the word <a href=“001.mp3”>elephant</a> and when the reader clicks “elephant”, it plays the mp3 file (or at least does what the browser is set to do with an mp3 file). I can’t figure out if there is any translation into Markdown that does this. The following does not work as desired: You can hear this in the word elephant This sends the end user to a separate page where they can click a download button or view raw, which will then play the file. Is there a way to cut out some steps, such as directly open the player without the intermediate page; or even, play it in the background or a second tab, while still displaying the main page? (End users will have minimal experience with computers, so simplicity is essential). Thanks, Dave Odden |
Beta Was this translation helpful? Give feedback.
Replies: 10 comments 2 replies
-
Since the MP3 files are in your repository already, you don’t have to link to them via the https://github.com link. You can link to them directly via your Pages site like this:
That (The reason why the https://github.com link doesn’t work the way you want is because we only enable linking of certain file types and force download of all others, such as MP3s, from https://github.com.) |
Beta Was this translation helpful? Give feedback.
-
My current question relates to this earlier question. My goal is to create a page where users can click on and listen to word recordings (similar to Forvo.com). My earlier strategy was to use an html anchor (<a href=“002.mp3”>play</a>"), but probably most users (no-tech) will be using phones and this won’t usually or ever work, since browsers will at best offer to download the file. I somewhat sorted out how to use HTML5 and Java to play sounds, and a simple example is at https://github.com/Logoori/Logoori.github.io/blob/master/4TestJS.htm. It works if I open it locally on my computer. I tried to open the same thing via https://htmlpreview.github.io/?https://github.com/Logoori/Logoori.github.io/blob/master/4TestJS.htm, and it displays correctly, but it does not play. The code inside that file is
I’m trying to figure out why it won’t work. One possible answer is that I’m trying to do something forbidden, and I should stop trying. :mansad: Another thing that I thought of is that I just don’t understand how this html preview thing works, and I’m thinking about this the wrong way. If anyone has any suggestions, that would be highly appreciated. |
Beta Was this translation helpful? Give feedback.
-
Since this is an extension of the original question, it should just be another post on the same topic so that people can get all the details. I’ve gone ahead and merged the topics for you 😀 |
Beta Was this translation helpful? Give feedback.
-
Well, never mind. It turns out that if I just open https://Logoori.github.io/WHATEVERFILE.HTML, there’s no need for an HTML preview prefix, and the page works as it’s supposed to. https://github.com/Logoori/Logoori.github.io/blob/master/ seems to have the same stuff as https://Logoori.github.io, but it’s treated differently (as a web page). |
Beta Was this translation helpful? Give feedback.
-
404
Please update link to solution |
Beta Was this translation helpful? Give feedback.
-
I dunno if I can rescind a “solution”. At some later point, the system changed and now it does not work. I suspect the code relied on an unofficial Java quirk. So it doesn’t work anymore, and I’ve abandoned the project for a while. |
Beta Was this translation helpful? Give feedback.
-
Could anyone help me out w/ this? I’m a very amateur coder looking to create my own little soundboard. I have the “daft” file as an mp3 on my desktop, but can’t get it onto my website. any help is welcomed! Thanks so much! <body> |
Beta Was this translation helpful? Give feedback.
-
I found a way to play audio in github pages Code:
|
Beta Was this translation helpful? Give feedback.
-
I sorted out the problem, so here’s a restatement of the problem and the solution. The problem was caused by bad Java. Originally, the page executed the following script:
It was then invoked via
This worked, then stopped working. The solution (d’oh!) is: take out source.
On various PCs, the defective code has always worked; so it’s not completely unrelated to GitHub pages, but it was basically a Java problem. |
Beta Was this translation helpful? Give feedback.
-
First page opened whilst looking for how to play github wav and other audio stuff from within the browser, vaguely recall seeing a chrome extension to play stuff in / from github, but then skimming this discussion made me think maybe the browser.console can be used to play resources. Example: https://github.com/kennethreitz/infinite-state-sample-pack/blob/master/Loops/Awaken_116/loop.wav Then I read further and learned how assets can be played by referencing relative link...
braindump on options for "using sounds in and on github" 📌 I asked my GPT thing (OpenAI: Ctrl Altman Del 😂)
So currently a multi-tab setup to drag /drop my work, but even that's more clunk than I'd like... |
Beta Was this translation helpful? Give feedback.
Well, never mind. It turns out that if I just open https://Logoori.github.io/WHATEVERFILE.HTML, there’s no need for an HTML preview prefix, and the page works as it’s supposed to. https://github.com/Logoori/Logoori.github.io/blob/master/ seems to have the same stuff as https://Logoori.github.io, but it’s treated differently (as a web page).