zmxv / react-native-sound

React Native module for playing sound clips
MIT License
2.78k stars 748 forks source link

Can't play from content:// path #776

Open arispati opened 2 years ago

arispati commented 2 years ago

Description

I use react-native-notification-sounds to get the sound list, it return the sound path: content://media/internal/audio/media/233. when i try to use that path, it shown an error message resource not found

Please post your code:

here is my code

import NotificationSounds from  'react-native-notification-sounds';
import Sound from 'react-native-sound';

NotificationSounds.getNotifications('alarm').then(alarmList  => {
  // content://media/internal/audio/media/233
  const sound = new Sound(alarmList[0].url, '', (error) => {
    if (error) {
      console.log('failed to load the sound', error);
      return;
    }
  });
});

Is your issue with...

Are you using...

Which versions are you using?

Does the problem occur on...

If your problem is happening on a device, which device?

khushal87 commented 2 years ago

@arispati Did you find a fix for this?

arispati commented 2 years ago

@arispati Did you find a fix for this?

Already sumbit a PR for fix this issue #777 but not merged yet, for now you can add the code from that PR