Giter Club home page Giter Club logo

Comments (10)

zmxv avatar zmxv commented on June 16, 2024

This sounds like a good idea. It will save us the trouble of manually adding sound assets to XCode.
I'm not sure if the require syntax works for non-images, though. Can you confirm?

from react-native-sound.

gnestor avatar gnestor commented on June 16, 2024

@amasad says it does: facebook/react-native#1043 (comment)

from react-native-sound.

danleveille avatar danleveille commented on June 16, 2024

@zmxv @gnestor So should this be working? Using require('./sound.mp3') gives me the following error:

Unable to resolve module ./sound.mp3 from [project]/index.ios.js: Invalid directory [project]/sound.mp3

from react-native-sound.

zmxv avatar zmxv commented on June 16, 2024

@danleveille Where is sound.mp3 located in your project?

from react-native-sound.

danleveille avatar danleveille commented on June 16, 2024

@zmxv For now I have it in the base project folder (same folder as index.ios.js, etc.). The path the error outputs is correct, which is strange because the file is definitely there.

from react-native-sound.

danleveille avatar danleveille commented on June 16, 2024

Just doing some more debugging:

When I do this:
var sound = require('./sound.mp3');

I get the error:

Unable to resolve module ./sound.mp3 from [project]/index.ios.js: Invalid directory [project]/sound.mp3

However, using an image seems to work fine:

var image = require('./image.png');

It seems like mp3 files aren't being included. Even if I put the MP3 file in node-modules/react-native-sound/

Any clue on how to make sure the mp3 file is included?

from react-native-sound.

zmxv avatar zmxv commented on June 16, 2024

@danleveille Is the mp3 file listed in the "Copy Bundle Resources" section under "Build Phases"?

from react-native-sound.

danleveille avatar danleveille commented on June 16, 2024

@zmxv No. Maybe I misinterpreted this Github issue. I thought @gnestor was suggesting that using require() would automatically include the MP3 file on both iOS and Android without having to manually add the sound files to to Xcode (and an Android directory).

from react-native-sound.

lopezjurip avatar lopezjurip commented on June 16, 2024

What's the current state of this issue?

from react-native-sound.

zmxv avatar zmxv commented on June 16, 2024

@mrpatiwi This is not a high priority feature on my to-do list.

from react-native-sound.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.