expo-av
Version:
Expo universal module for Audio and Video playback
19 lines • 790 B
JavaScript
import ExponentAV from '../ExponentAV';
let _enabled = true;
export function isAudioEnabled() {
return _enabled;
}
export function throwIfAudioIsDisabled() {
if (!_enabled) {
throw new Error('Cannot complete operation because audio is not enabled.');
}
}
export async function setIsEnabledAsync(value) {
_enabled = value;
await ExponentAV.setAudioIsEnabled(value);
// TODO : We immediately pause all players when disabled, but we do not resume all shouldPlay
// players when enabled. Perhaps for completeness we should allow this; the design of the
// enabling API is for people to enable / disable this audio library, but I think that it should
// intuitively also double as a global pause/resume.
}
//# sourceMappingURL=AudioAvailability.js.map