BRDarkerStick
BRDarkerStick

Reputation: 3

Show controls on a Audio() object created in javascript

I have an Audio() object created in javascript like this:
const audio = new Audio();
After giving it the atributes like .source and audio.controls = true I couldn't find the controls in my page.
What I want to do is show the controls of that audio on a <div> in the HTML

Upvotes: 0

Views: 203

Answers (1)

Youness Belfkih
Youness Belfkih

Reputation: 28

Not sure what you did but setting the controls to true shows the element in the document.

An image showing the audio controls working

If someone else has a similar problem, try inspecting in the hierarchy if one of the ancestors is hidden.

https://codepen.io/blfunex/pen/ZELRQbL

Upvotes: 1

Related Questions