unmute: { id: 'video.unmute', defaultMessage: 'Unmute sound' },
});
-const arrayOf = (length, fill) => (new Array(length)).fill(fill);
-
export default @injectIntl
class Audio extends React.PureComponent {
src: PropTypes.string.isRequired,
alt: PropTypes.string,
duration: PropTypes.number,
+ peaks: PropTypes.arrayOf(PropTypes.number),
height: PropTypes.number,
preload: PropTypes.bool,
editable: PropTypes.bool,
}
_updateWaveform () {
- const { src, height, duration, preload } = this.props;
+ const { src, height, duration, peaks, preload } = this.props;
const progressColor = window.getComputedStyle(document.querySelector('.audio-player__progress-placeholder')).getPropertyValue('background-color');
const waveColor = window.getComputedStyle(document.querySelector('.audio-player__wave-placeholder')).getPropertyValue('background-color');
cursorWidth: 0,
progressColor,
waveColor,
- forceDecode: true,
+ backend: 'MediaElement',
+ interact: preload,
});
wavesurfer.setVolume(this.state.volume);
wavesurfer.load(src);
this.loaded = true;
} else {
- wavesurfer.load(src, arrayOf(1, 0.5), null, duration);
+ wavesurfer.load(src, peaks, 'none', duration);
this.loaded = false;
}
this.wavesurfer.createBackend();
this.wavesurfer.createPeakCache();
this.wavesurfer.load(this.props.src);
+ this.wavesurfer.toggleInteraction();
this.loaded = true;
}
.box-widget input[type="email"],
.box-widget input[type="password"],
.box-widget textarea,
-.statuses-grid .detailed-status {
+.statuses-grid .detailed-status,
+.audio-player {
border: 1px solid lighten($ui-base-color, 8%);
}
.compose-form .compose-form__warning {
box-shadow: none;
}
+
+.audio-player .video-player__controls button,
+.audio-player .video-player__time-sep,
+.audio-player .video-player__time-current,
+.audio-player .video-player__time-total {
+ color: $primary-text-color;
+}