react-native-audioplayer icon indicating copy to clipboard operation
react-native-audioplayer copied to clipboard

Android Support

Open ghost opened this issue 10 years ago • 8 comments

ghost avatar Sep 15 '15 15:09 ghost

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?

Sh3rawi avatar Oct 08 '15 18:10 Sh3rawi

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

ghost avatar Oct 09 '15 07:10 ghost

@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 avatar Oct 09 '15 08:10 andreaskeller

@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 avatar Oct 09 '15 10:10 Sh3rawi

@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?

andreaskeller avatar Oct 09 '15 14:10 andreaskeller

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 ?

Sh3rawi avatar Oct 09 '15 14:10 Sh3rawi

Sounds good to me.

andreaskeller avatar Oct 09 '15 14:10 andreaskeller

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

Sh3rawi avatar Oct 09 '15 14:10 Sh3rawi