The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> How to play an audio track without using "controls"
giomach
post Jun 19 2021, 12:07 PM
Post #1





Group: Members
Posts: 2
Joined: 19-June 21
Member No.: 27,985



I have an audio file (mp3), and I want to allow the web user to choose to play a section (track) of it.

I could split the audio file into many separate files, but I have begun to look at the <track> sub-element of the <audio> element of HTML5.

Many webpages tell us how to formulate this element, eg. to give the start time of each track in a .vtt file, and that is fine.

But I don't want "controls", I want to display a list of tracks, and let the user decide which track to play, and click an icon to play it.

It must be blindingly obvious how to do this, but I can't find the HTML statement to start up a numbered track.

Thanks for any hints.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
The_webmaster
post Jun 21 2021, 10:29 AM
Post #2


Member
***

Group: Members
Posts: 37
Joined: 5-February 21
Member No.: 27,773



You can set an audio to play with an onclick(example: button onclick) without controls. This can be done with javascript
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
giomach
post Jul 1 2021, 06:13 AM
Post #3





Group: Members
Posts: 2
Joined: 19-June 21
Member No.: 27,985



Thanks for your reply.

I have not found how to use <track>, but I have managed to get something working using <select> (and some javascript, as you suggested).

I found this example useful as a starting point: https://html5.komplett.cc/code/chap_video/j...oPlayer_en.html
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 25th July 2021 - 11:58 PM