Open user-o712345 opened 1 month ago
u need some special tricks to play local files on android 12+. its due to the "newly" introduced file access permissions.
see discussions: https://github.com/podverse/podverse-rn/issues/2117
and PRs https://github.com/lovegaoshi/azusa-player-mobile/pulls?q=is%3Apr+local+playback+ https://github.com/podverse/podverse-rn/pull/2154
Thanks @lovegaoshi! I'll look through these.
On a quick skim, it seems you did not use MediaStore.Files (ie. file:///data/user/0/audiopath...) collection, but a directory that would look like file:///storage/emulated/0/Download/
I'm just confirming, because someone had mentioned in one of the comments that they were able to use MediaStore.Files as the RNTP audio URL, without fully illustrating their solution. The thing is, I would much rather store the audio in one of the following directories:
just read the linked issue
The other solution is MANAGE_EXTERNAL_STORAGE which google will heavily scrutinize for apps on google play.
and my posted snippet literally says MediaStore.Audio.Media.EXTERNAL_CONTENT_URI. it queries all media files without a filter.
Possible Bug:
I want to play tracks from my local file system using react-native-track-player, but getting no audible audio play on the Android device that I am emulating and testing on. Plus, no error feedback on Metro or React Native Debugger.
What I Tried:
I have tried several audio formats and local directories, but still not getting past "ready"
PlaybackState
inTrackPlayer.addEventListener
I read through all RNFS, RNFetchBlob, RNFB related issues in this lib, but nothing helped.
Code To Reproduce:
Current Status:
TrackPlayer.getActiveTrack()
does pick the 1st item in the array passed toTrackPlayer.add()
, but still no audible play.Navigation.registerComponent()
andgestureHandlerRootHOC()
. Not sure if there are lib conflicts, but for RNTP, I only usedTrackPlayer.registerPlaybackService(() => PlaybackService)
Env Info: