react-sound
react-sound copied to clipboard
Volume props is not working
I am trying to control the volume of react-sound but, it looks alike volume props is not being accepted by component. here is the same code which I wrote and your NPM props.
My code:
this.state = {
volume: 10
}
<Sound
url={this.prepareUrl(this.state.track.stream_url)}
playStatus={this.state.playStatus}
onPlaying={this.handleSongPlaying.bind(this)}
playFromPosition={this.state.playFromPosition}
volume={this.state.volume}
onPause={() => console.log('Paused')}
onResume={() => console.log('Resumed')}
onStop={() => console.log('Stopped')}
onFinishedPlaying={this.handleSongFinished.bind(this)}/>
<Player
onVolumeUp={() => this.setState({volume: volume >= 100 ? volume : volume+10})}
onVolumeDown={() => this.setState({volume: volume <= 0 ? volume : volume-10})}
/>
Evan these log is not working.
Some props from your NPM :
{
key: 'propTypes',
value: {
url: _react.PropTypes.string.isRequired,
playStatus: _react.PropTypes.oneOf(Object.keys(playStatuses)).isRequired,
position: _react.PropTypes.number,
playFromPosition: _react.PropTypes.number,
onLoading: _react.PropTypes.func,
onPlaying: _react.PropTypes.func,
onFinishedPlaying: _react.PropTypes.func
},
enumerable: true
}, {
key: 'defaultProps',
value: {
playFromPosition: 0,
onLoading: noop,
onPlaying: noop,
onFinishedPlaying: noop
},
enumerable: true
}
can you please help me to understand this why I am not able to control the sound. am I missing something or something else?