MetalMentos
MetalMentos

Reputation: 77

Does addeventlistener("volumechange", ...) work on ios?

I am currently developing a PWA. Trying to detect when the user presses the volume up or volume down button on ios to fire my callback function. However, it does not seem to work.

 document.querySelector(".audioElement").addEventListener("volumechange", function () { code block })

Upvotes: 1

Views: 353

Answers (1)

Mosrainis
Mosrainis

Reputation: 500

No you can't use it on iOS because the volume property always returns 1.

From official Apple document :

On iOS devices, the audio level is always under the user’s physical control. The volume property is not settable in JavaScript. Reading the volume property always returns 1.

Upvotes: 1

Related Questions