react-howler
Advanced tools
Comparing version
@@ -0,1 +1,5 @@ | ||
# 5.2.0 - 2021-07-19 | ||
- Added: `rate` prop and method (#119) | ||
# 5.1.0 - 2021-06-24 | ||
@@ -2,0 +6,0 @@ |
@@ -83,2 +83,3 @@ 'use strict'; | ||
volume: props.volume, | ||
rate: props.rate, | ||
onend: props.onEnd, | ||
@@ -174,2 +175,25 @@ onplay: props.onPlay, | ||
/** | ||
* Update playback rate (speed) of sound or group | ||
* If no value given, apply default rate of 1 | ||
* If no id given, apply rate to all | ||
* @param {Number} value = 1 [rate to apply] | ||
* @param {Number} id = undefined [sound of group to update] | ||
*/ | ||
}, { | ||
key: 'rate', | ||
value: function rate() { | ||
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1; | ||
var id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined; | ||
if (typeof value === 'number') { | ||
if (id) { | ||
this.howler.rate(value, id); | ||
} else { | ||
this.howler.rate(value); | ||
} | ||
} | ||
} | ||
/** | ||
* Check the load status of the Howl | ||
@@ -324,2 +348,3 @@ * @return {String} [unloaded, loading or loaded] | ||
volume: _propTypes2.default.number, | ||
rate: _propTypes2.default.number, | ||
onEnd: _propTypes2.default.func, | ||
@@ -345,2 +370,3 @@ onPause: _propTypes2.default.func, | ||
volume: 1.0, | ||
rate: 1, | ||
onEnd: _utils.noop, | ||
@@ -347,0 +373,0 @@ onPause: _utils.noop, |
{ | ||
"name": "react-howler", | ||
"version": "5.1.0", | ||
"version": "5.2.0", | ||
"description": "A React.js wrapper for howler.js (audio player)", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -67,2 +67,3 @@ # react-howler | ||
volume | 1.0 | The volume of the specific howl, from `0.0` to `1.0` | ||
rate | 1 | The initial playback rate (speed) | ||
html5 | false | Set to `true` to force HTML5 Audio. This should be used for large audio files so that you don't have to wait for the full file to be downloaded and decoded before playing. | ||
@@ -105,2 +106,8 @@ format | [] | howler.js automatically detects your file format from the extension, but you may also specify a format in situations where extraction won't work (such as with a SoundCloud stream). | ||
#### rate([value], [id]) | ||
Speeds up/down an audio playback. | ||
Calling with no arguments will reset all howls to default rate. | ||
* **value**: `Number` `optional` The playback rate. If empty, will default to `1`. | ||
* **id**: `Number` `optional` The sound ID. If empty, all sounds in group get updated. | ||
#### Other howler.js methods | ||
@@ -107,0 +114,0 @@ If you need to use other howler.js [methods](https://github.com/goldfire/howler.js#methods) |
25589
4.8%329
7.52%181
4.02%