You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now my question is how I would play this audio file, stored on the users device, via the two paths being given.
I tried calling SoundPlayer.playSoundFile(content://com.android.providers.media.documents/document/audio%3A31, 'mp3'), but it throws this error:
It seems that react-native-sound-player can't read the file based on the content:// protocol.
I'm using react-native-sound-player version 0.10.9.
Code to reproduce:
import DocumentPicker from 'react-native-document-picker';
import SoundPlayer from 'react-native-sound-player'
const accessFile = async () => {
try {
const audioRes = await DocumentPicker.pick({
type: [DocumentPicker.types.audio],
});
SoundPlayer.playSoundFile(audioRes.uri, 'mp3')
} catch (err) {
if (DocumentPicker.isCancel(err)) {
// User cancelled the picker, exit any dialogs or menus and move on
} else {
throw err;
}
}
}
I hope someone can point me in the right direction, as this has been troubling me for some time now :-)
The text was updated successfully, but these errors were encountered:
Hi!
I'm using
react-native-document-picker
version5.0.4
, to get local files on the users device.On Android, after choosing an audio file, it returns me an object like this:
Now my question is how I would play this audio file, stored on the users device, via the two paths being given.
I tried calling
SoundPlayer.playSoundFile(content://com.android.providers.media.documents/document/audio%3A31, 'mp3')
, but it throws this error:It seems that
react-native-sound-player
can't read the file based on thecontent://
protocol.I'm using
react-native-sound-player
version0.10.9
.Code to reproduce:
I hope someone can point me in the right direction, as this has been troubling me for some time now :-)
The text was updated successfully, but these errors were encountered: