Fork me on GitHub
#cljsrn
<
2016-08-25
>
coyotespike17:08:33

Has anyone worked with react-native-sound? It runs with an absolute path, but I figure an absolute path won't work when I build for release. The source at https://github.com/zmxv/react-native-sound says to say var whoosh = new Sound('whoosh.mp3', Sound.MAIN_BUNDLE). I have:

(def Audio-player (js/require "react-native-sound"))
(def adv-sound (js/require "./images/advertising.mp3"))
(def audio-player (Audio-player. (.-MAIN_BUNDLE  Audio-player) adv-sound))
This doesn't work, although (def audio-player (Audio-player. "absolute-path-to-sound-file")) does, and no examples on Github come up.

artemyarulin17:08:42

@coyotespike So did you log the path Sound.MAIN_BUNDLE? According to source (on iOS) it should be the right one https://github.com/zmxv/react-native-sound/blob/master/RNSound/RNSound.m#L54

coyotespike17:08:37

hey @artemyarulin, thanks for the suggestion! Do you mean debug on Chrome? Having issues getting that to go, obviously I'll keep trying. I added the sound file like an image, by dropping into a folder, then running re-natal use-figwheel. I'm also thinking about whether I'm supposed to add sound files differently.

artemyarulin17:08:47

well I mean (.log js/console Sound.MAIN_BUNDLE) to see what the actual path and then check if your file is actually there (for IOS simulator it will return local file system full path)

coyotespike17:08:55

Huh...that path appears to end at data/Containers/Bundle/Application/more-numbers-here/ponder.app. The app is there, but no file.

artemyarulin17:08:31

what’s inside? app is just a folder, you can ls inside easily

coyotespike18:08:42

Oh yeah! lemme check... I also just followed the zmxv/react-native-sound directions to add a file.

coyotespike18:08:29

Base.lproj         PkgInfo            assets             ponder
Frameworks         PlugIns            main.jsbundle
Info.plist         advertising.mp3    main.jsbundle.meta
`

coyotespike18:08:29

So now I've got /ponder.app/advertising.mp3, where before I only had /ponder.app/assets/images/advertising.mp3

artemyarulin18:08:12

does it work now?

coyotespike18:08:28

lol sadly no..."The operation couldn't be completed", error messages

artemyarulin18:08:46

well, that’s some progress 🙂

coyotespike18:08:20

I'll keep trying to add it manually to Xcode, which I'm guessing will eventually work. In general, though, how does one bundle sound-files with the app, using re-natal? Seems like it should work like the image files, but that doesn't appear to be the case.

coyotespike18:08:40

Maybe I should open a ticket.

artemyarulin19:08:18

Yeah, I’m not using re-natal, so cannot say