UNPKG

react-native-audio-api

Version:

react-native-audio-api provides system for controlling audio in React Native environment compatible with Web Audio API specification

23 lines (22 loc) 824 B
"use strict"; import BaseAudioContext from "./BaseAudioContext.js"; import AudioManager from "../system/index.js"; import { NotSupportedError } from "../errors/index.js"; export default class AudioContext extends BaseAudioContext { constructor(options) { if (options && options.sampleRate && (options.sampleRate < 8000 || options.sampleRate > 96000)) { throw new NotSupportedError(`The provided sampleRate is not supported: ${options.sampleRate}`); } super(global.createAudioContext(options?.sampleRate || AudioManager.getDevicePreferredSampleRate(), options?.initSuspended || false)); } async close() { return this.context.close(); } async resume() { return this.context.resume(); } async suspend() { return this.context.suspend(); } } //# sourceMappingURL=AudioContext.js.map