Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to replace file link with a name during Safari/Chrome audio playback on home screen?

I have been googling for a while, and do let me know if this question is a repeat, but here's what I am trying to achieve: I am making a HTML <audio> playback system, with help of audio.js library. Audio playback is working perfectly fine, with some glitches in iphone, but when I playback on phone (Android or iOS), audio control shows up in phone's media player and home screen, which is a good thing but its showing the link to my audio, not the name of the file.

Here's what's happening:

What's Happening!

Here's what I want (taken from a famous audio playback website):

Requirement

Please, let me know what I am missing or if the question is incomplete or incorrect! Any sort off comment or suggestion will be thankful. Thanks

like image 278
sphinx Avatar asked Aug 26 '17 04:08

sphinx


2 Answers

I think setting title attribute (on the audio element) to the string you want to be displayed, may be the solution you want.

PS: I'm inexperienced in SO so don't lay it all on me please, just trying to help.

like image 180
fabiofcferreira Avatar answered Oct 19 '22 23:10

fabiofcferreira


In response to the bounty, I'm pretty sure there is NO credible or official source for the accepted answer.

Official documentation on <audio> tag consistently makes no reference to the title attribute MDN: <audio> as an example. And using title attribute on <audio> element will not result in any sort of magic behavior for typical users of the native api.

The author of audio.js also makes no mention of title in his documentation, nor any mention of it in his well-commented source code. Author of audio.js also does not use it in the official examples of module usage.

Two examples are provided by audio.js documentation that display song titles. One of them uses an <h1> to display the title and the other one uses a :before pseudo-element. No sign of a title attribute anywhere.

The fact that suggestion to use title attribute answered OP's question seems to be a happy coincidence.

@sphinx

like image 38
skylize Avatar answered Oct 19 '22 23:10

skylize