We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi, is there a way to play a local bundled audio file as soon as the component is loaded or rendered?
similar to on html
So that it is played as an intro sound without any required interaction from the user.
Thanks
The text was updated successfully, but these errors were encountered:
You just need to update the componentDidMount event to load the file and play it.
componentDidMount() { (async () => { await Audio.setAudioModeAsync({ allowsRecordingIOS: false, interruptionModeIOS: Audio.INTERRUPTION_MODE_IOS_DO_NOT_MIX, playsInSilentModeIOS: true, shouldDuckAndroid: true, interruptionModeAndroid: Audio.INTERRUPTION_MODE_ANDROID_DO_NOT_MIX, }); await this._updatePlaybackInstanceForIndex(playing); this._onPlayPausePressed(); })(); (async () => { await Font.loadAsync({ 'cutive-mono-regular': require('./assets/fonts/CutiveMono-Regular.ttf'), }); this.setState({ fontLoaded: true }); })(); }
Sorry, something went wrong.
I changed it but it says "Can't find variable:playing"
Hey, late follow-up here but I suggest going through the Audio documentation to see the best way of doing this
No branches or pull requests
Hi, is there a way to play a local bundled audio file as soon as the component is loaded or rendered?
similar to on html
So that it is played as an intro sound without any required interaction from the user.
Thanks
The text was updated successfully, but these errors were encountered: