ViroSound/Spatial Sound not working
Environment
Please provide the following information about your environment:
- Development OS: Mac
- Device OS & Version: iOS 12.0 iPad
- Version: ViroReact newest Version and 0.57.1
- Device(s): iPad
Description
I have a question regarding ViroSound/SpatialSound. It doesn't seem to play at all. I've put it inside of a ViroNode with two FlexViews. The source link is correct but no sound plays, I've put it in a local folder. Am I doing this correctly?
Thanks.
<ViroNode>
<ViroFlexView
materials="card"
height={4}
width={4.5}
position={[0, 0, -10]}>
<ViroImage
height={2}
width={3.5}
source={require("./res/recipes.png")}
/>
<ViroAnimatedImage
style={{marginLeft:0.2}}
height={0.9}
width={1.5}
source={require("./res/giphyfab.gif")}
/>
</ViroFlexView>
<ViroFlexView
height={3}
width={3.5}
position={[-5, 0, -10]}>
<ViroImage
opacity={0.95}
height={3}
width={3.5}
source={require("./res/dummy.png")}
/>
</ViroFlexView>
**<ViroSpatialSound source={require("./res/jazz.mp3")} />**
</ViroNode>
Not exactly sure what the issue might be. Can you try adding a position or volume to the spatial sound component. There is an example under our Sound section -> https://docs.viromedia.com/v2.13.0/docs/audio
I have done both, and added volume and mute options for ViroSound as well, none seem to play. For Spatialsound I put it close to me on the z axis as well but no luck. Are you able to replicate the issue?
Can you try adding -> paused={false}
Have done that as well.
This might be an issue with the sound file you are trying to use. Spatial sound requires a single-channel sound (mono). Here is a link to a sound file that should work -> https://s3-us-west-2.amazonaws.com/viro/cube_sound.wav
Hmm, ok i will try that. But ViroSound also wasn't working, does it have the same requirement?
ViroSound is working for me. Here is a link to an mp3 file you can try -> https://s3-us-west-2.amazonaws.com/viro/Assets/rain.mp3
I've tried the sound but it only seems to work in Android and not on iOS, this is for both ViroSound and ViroSpatialSound.
Interesting, I tested both ViroSound and ViroSpatialSound on iOS (iPhone X) and they were working fine with the files listed above. Is it possible there is a volume setting on your device you need to adjust? Otherwise, I am not sure what the issue could be.
I tested it on iOS and it is now working. I had to fill out all the essential props for it to play, perhaps some of the defaults are not registering. On Android though, the sound plays fine without these props so I assume the defaults work there.