50

unmute-ios-audio: Enable/unmute WebAudio on iOS, even while mute switch is on

 5 years ago
source link: https://www.tuicool.com/articles/nq6ZnyJ
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

unmute-ios-audio

Enable/unmute WebAudio on iOS, even while mute switch is on

On Safari for iOS, audio is allowed to play when the device's mute switch is enabled, but only for HTML5 audio tags, and not for Web Audio. This module fixes that and adds consistency and reliability to web audio in Safari. Note that a "user activation" in the form of a click or touchstart event is still required to play audio. This package merely unmutes Web Audio even while the mute switch is enabled on the device.

This package works by playing a short, silent sound using an <audio> tag whenever the user interacts with the page. That's it.

Built for and used on BitMidi , a free MIDI database. Works in the browser with browserify !

install

npm install unmute-ios-audio

usage

var unmuteAudio = require('unmute-ios-audio')

// Call once, at page load time
unmuteAudio()

API

unmuteAudio()

license

MIT. Copyright (c) Feross Aboukhadijeh .


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK