项目作者: hu2di

项目描述 :
Play mosquito sound in React Native (iOS & Android)
高级语言: Objective-C
项目地址: git://github.com/hu2di/react-native-mosquito-sound.git
创建时间: 2018-03-19T05:16:58Z
项目社区:https://github.com/hu2di/react-native-mosquito-sound

开源协议:MIT License

下载


react-native-mosquito-sound

INSTALL

  1. npm install react-native-sound —save
    react-native link react-native-sound

RESOURCE

  1. Add file “yoursound.mp3” to Resources folder in iOS XCode project

CODE

  1. import Sound from “react-native-sound”;

  2. constructor(props) {
    super(props);
    Sound.setCategory(“Playback”);
    mSound = new Sound(“yoursound.mp3”, Sound.MAIN_BUNDLE);
    }

  3. _playSound() {
    mSound.play(success => {

    1. if (success) {
    2. console.log("Success");
    3. } else {
    4. console.log("Failure");
    5. mSound.reset();
    6. }

    });
    }

About