React-native-track-player: Local files

Created on 16 Aug 2017  路  11Comments  路  Source: react-native-kit/react-native-track-player

I'm currently downloading files for later playback using RNFetchBlob.

It is currently possible to play those files?

If not, maybe I could look into developing that?

Most helpful comment

Yes! That was it.

Here is an example of the URL I'm using:

file:///Users/anders/Library/Developer/CoreSimulator/Devices/A5FEF161-0150-49C2-BD27-407D5CDB29C4/data/Containers/Data/Application/350969AD-B6D8-49BF-97CA-5FDA0B798248/Library/Caches/zetlandAudioCache/httpszetlanddevelopments3eucentral1amazonawscom4fb386f0397211e7a810098ab3eb3ac0s_town_mixdownmp3.mp3

All 11 comments

What format do these files have? Do you require() them? or do you directly access their file path?

I have their file path (via RNFetchBlob)

I don't think I can require them because they are downloaded runtime based on what the user puts on his/her playlist

Can you show me what an example file path looks like? The player supports local files but we may need to add a scheme for it to recognise that it's a local file.

Yes. :)

Here is an example path:

/Users/anders/Library/Developer/CoreSimulator/Devices/A5FEF161-0150-49C2-BD27-407D5CDB29C4/data/Containers/Data/Application/350969AD-B6D8-49BF-97CA-5FDA0B798248/Library/Caches/zetlandAudioCache/httpszetlanddevelopments3eucentral1amazonawscom4fb386f0397211e7a810098ab3eb3ac0s_town_mixdownmp3.mp3

Try passing it in normally but making sure that the url you pass is of the format file://path. I believe that should work :)

Yes! That was it.

Here is an example of the URL I'm using:

file:///Users/anders/Library/Developer/CoreSimulator/Devices/A5FEF161-0150-49C2-BD27-407D5CDB29C4/data/Containers/Data/Application/350969AD-B6D8-49BF-97CA-5FDA0B798248/Library/Caches/zetlandAudioCache/httpszetlanddevelopments3eucentral1amazonawscom4fb386f0397211e7a810098ab3eb3ac0s_town_mixdownmp3.mp3

@Guichaguri let's make sure Android can also handle this

It seems to be working just fine on Android as well @dcvz @Guichaguri 馃憤

@Guichaguri @dcvz hi, I am having same with local files on the 1.0.0 version

file:///storage/emulated/0/Music/track_id_1435170.mp3
data:
code: "exoplayer"
message: "Unexpected ClassCastException: sun.net.www.protocol.file.FileURLConnection cannot be cast to java.net.HttpURLConnection"
type: "playback-error"

@punksta This has been fixed in the latest dev branch.

@Guichaguri it works well in dev branch, thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

toooldmohammad picture toooldmohammad  路  3Comments

EhteshamAnwar picture EhteshamAnwar  路  3Comments

moduval picture moduval  路  4Comments

Sathyanarayan09 picture Sathyanarayan09  路  3Comments

KalebPortillo picture KalebPortillo  路  4Comments