@lls/lls-audio 0.0.81 → 0.0.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/player/Audio.js +19 -2
package/package.json
CHANGED
package/player/Audio.js
CHANGED
|
@@ -31,7 +31,11 @@ var Player = function (_Component) {
|
|
|
31
31
|
_this.requestAnimationId = null;
|
|
32
32
|
|
|
33
33
|
_this.play = function () {
|
|
34
|
-
|
|
34
|
+
try {
|
|
35
|
+
_this.refs.player.play();
|
|
36
|
+
} catch (e) {
|
|
37
|
+
// On tablet play needs to be triggered with a hand gesture
|
|
38
|
+
}
|
|
35
39
|
};
|
|
36
40
|
|
|
37
41
|
_this.pause = function () {
|
|
@@ -142,7 +146,7 @@ var Player = function (_Component) {
|
|
|
142
146
|
_props$preload = _props.preload,
|
|
143
147
|
preload = _props$preload === undefined ? 'auto' : _props$preload;
|
|
144
148
|
|
|
145
|
-
return _react2.default.createElement('audio', { ref: 'player', autoPlay:
|
|
149
|
+
return _react2.default.createElement('audio', { ref: 'player', autoPlay: false, src: src, loop: loop, preload: preload });
|
|
146
150
|
}
|
|
147
151
|
|
|
148
152
|
// Controls
|
|
@@ -156,6 +160,15 @@ var Player = function (_Component) {
|
|
|
156
160
|
this.refs.player.volume = volume / 100;
|
|
157
161
|
this.setStateWithCallback({ volume: volume });
|
|
158
162
|
}
|
|
163
|
+
}, {
|
|
164
|
+
key: 'componentWillReceiveProps',
|
|
165
|
+
value: function componentWillReceiveProps(newProps) {
|
|
166
|
+
if (newProps.src !== this.props.src) {
|
|
167
|
+
if (newprops.autoPlay) {
|
|
168
|
+
this.play();
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
159
172
|
|
|
160
173
|
// HTML5 events
|
|
161
174
|
|
|
@@ -170,6 +183,10 @@ var Player = function (_Component) {
|
|
|
170
183
|
player.addEventListener('play', this.onPlay);
|
|
171
184
|
player.addEventListener('pause', this.onPause);
|
|
172
185
|
player.addEventListener('timeupdate', this.onAudioUpdate);
|
|
186
|
+
|
|
187
|
+
if (this.props.autoPlay) {
|
|
188
|
+
this.play();
|
|
189
|
+
}
|
|
173
190
|
}
|
|
174
191
|
}, {
|
|
175
192
|
key: 'componentWillUnmount',
|