UNPKG

react-native-audio-playback

Version:

Play sounds with lowest latency in React Native using Google Oboe for Android and Audio Unit for iOS

40 lines (31 loc) 677 B
import { loopSounds, playSounds, seekSoundsTo, setSoundsVolume, unloadSound, } from '../module'; export class Player { public readonly id: string; constructor(id: string) { this.id = id; } public unloadSound(): void { unloadSound(this.id); } public loopSound(value: boolean): void { loopSounds([[this.id, value]]); } public playSound(): void { playSounds([[this.id, true]]); } public pauseSound(): void { playSounds([[this.id, false]]); } public seekTo(timeInMs: number): void { seekSoundsTo([[this.id, timeInMs]]); } public setVolume(volume: number): void { setSoundsVolume([[this.id, volume]]); } }