andreaskeller/react-native-audioplayer

Android Support

Opened this issue · 8 comments

Android Support

I have a pull request that is nearly complete(btw thanks for your device info module, helped me alot with this). The thing is, from what i've seen/tried: when playing an audio file from within android's own media player utility, you should write the name of the file without its extension ('beep"). However, the iOS implementation in this module requires an extension to play the sound("beep.mp3").
If im not missing anything, one of the two platforms' implementation must be changed to have unified function calls, no?

What about making the JS api require the file extension but then remove it automatically, if we're on android?

@rebeccahughes that could be a possible solution. @Sh3rawi I have seen you published the android code as your own package (react-native-audio-player). I am currently developing the android versions of the app where I have used initally this audio player. So your work comes in handy for me. Do you still plan to send a pull request? I would appreciate to include your work into this repository as the two interfaces are really similar.

@andreaskeller Yes I still want to do it. Could JS know what platform we are on without using an extra module as @rebeccahughes 's ? Or how about we let Android do the removal ? If we finish this the pull request would be ready.

@Sh3rawi from javascript you could do something like

if (Platform.OS === 'ios') {
// ios code
} else if (Platform.OS === 'android') {
// android code
}

or put the different parts into files *.ios.js and *.android.js.

But I think I would prefer if you would just remove the extension in the android java code. what do you think?

Hmm. I guess doing it with the the Platform module is better as it also clarifies to anyone who wants to use the module and opens the JS file to see the api, to also directly see the manipulation - even without reading the docs. No ?

Sounds good to me.

Very well then. I'll check that everything is good and running to submit the PR.