react-h5-audio-player
Advanced tools
Comparing version 0.2.4 to 0.2.5
@@ -281,9 +281,7 @@ 'use strict'; | ||
key: 'componentDidUpdate', | ||
value: function componentDidUpdate() { | ||
var _props = this.props, | ||
audioFile = _props.audioFile, | ||
isPlaying = _props.isPlaying; | ||
value: function componentDidUpdate(prevProps, prevState) { | ||
var src = this.props.src; | ||
if (isPlaying && this.audio.paused && !!audioFile) { | ||
this.play(); | ||
if (src !== prevProps.src) { | ||
this.audio.play(); | ||
} | ||
@@ -387,3 +385,3 @@ } | ||
}, style: style.togglePlay }, | ||
this.state.isPlaying ? _react2.default.createElement('i', { style: style.pause }) : _react2.default.createElement('i', { style: style.play }) | ||
this.state.isPlaying ? _react2.default.createElement('i', { className: 'pause-icon', style: style.pause }) : _react2.default.createElement('i', { className: 'play-icon', style: style.play }) | ||
) | ||
@@ -390,0 +388,0 @@ ), |
{ | ||
"name": "react-h5-audio-player", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"description": "A React audio player with UI. Mobile compatible.", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -249,6 +249,6 @@ import React from 'react'; | ||
componentDidUpdate() { | ||
const { audioFile, isPlaying } = this.props; | ||
if (isPlaying && this.audio.paused && !!audioFile) { | ||
this.play(); | ||
componentDidUpdate(prevProps, prevState) { | ||
const { src } = this.props; | ||
if (src !== prevProps.src) { | ||
this.audio.play(); | ||
} | ||
@@ -319,4 +319,4 @@ } | ||
this.state.isPlaying ? | ||
<i style={style.pause} /> : | ||
<i style={style.play} /> | ||
<i className="pause-icon" style={style.pause} /> : | ||
<i className="play-icon" style={style.play} /> | ||
} | ||
@@ -323,0 +323,0 @@ </a> |
30590
750