Not working on Android | number of channels is -1
See original GitHub issueSounds are working on iOS using the below code but not working on Android. I have notification.wav file in the android/app/src/main/res/raw directory. Help please.
const s = new Sound('notification.wav', Sound.MAIN_BUNDLE, (e) => {
if (e) {
console.log('error', e);
return;
}
console.log('sound: duration in seconds: ' + s.getDuration() + 'number of channels: ' + s.getNumberOfChannels());
s.play(() => s.release());
});
On log I am getting this but no sound played. And the number of channels is -1
sound: duration in seconds: 0.542number of channels: -1
Issue Analytics
- State:
- Created 6 years ago
- Comments:33 (7 by maintainers)
Top Results From Across the Web
Create and Manage Notification Channels - Android Developers
Starting in Android 8.0 (API level 26), all notifications must be assigned to a channel. For each channel, you can set the visual...
Read more >android - Setup notification Channel, currently not working
1 Answer 1 ... You need to add setChannel(notificationChannel) in the notification Builder, like this: NotificationCompat.Builder builder = new ...
Read more >Troubleshoot sign-in problems on mobile devices, smart TVs ...
Learn how to fix issues signing in to your YouTube channel on your mobile ... Account to your mobile device using the instructions...
Read more >Working With Android Notification Channels - Dan Lew Codes
Google has introduced notification channels to Android Oreo. ... You want to hit that Goldilocks range - not too many channels, not too...
Read more >Top 9 Ways to Fix Notifications Not Working on YouTube
If you aren't getting notifications only from a few channels, check those channels' notification settings. Step 1: Open the YouTube app and tap ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
solved… just put “music.play()” out of constructor error part, like this.
new Sound()
uses android.media.MediaPlayer.prepareAsync(). Sonew Sound()
returns immediately and it could have been not prepared completely. You could try to add a timeout, but it’s most save to start playing from theonError
callback, I think. (and the name onError is a bit confusing)This must be added to the documentation. I’ll submit a PR next week.