diff --git a/demo/demo.js b/demo/demo.js
index 5a11d49..80d2fa7 100644
--- a/demo/demo.js
+++ b/demo/demo.js
@@ -6,6 +6,7 @@ import {
Sequencer,
Sampler,
Synth,
+ Recorder
} from '../src';
import Polysynth from './polysynth';
@@ -19,6 +20,7 @@ export default class Demo extends Component {
this.state = {
playing: true,
+ downloadLinkVisible: false,
};
this.handleAudioProcess = this.handleAudioProcess.bind(this);
@@ -32,6 +34,26 @@ export default class Demo extends Component {
playing: !this.state.playing,
});
}
+
+ handleRecordStop(blob, fileName) {
+ this.setState({
+ downloadLinkVisible: true,
+ }, () => {
+ const url = URL.createObjectURL(blob);
+ const anchor = this.refs.downloadLink;
+ anchor.href = url;
+ anchor.download = new Date().toISOString() + '.wav';
+ });
+ }
+ renderDownloadLink() {
+ if (!this.state.downloadLinkVisible) {
+ return null;
+ }
+
+ return (
+ Download
+ );
+ }
render() {
return (
@@ -39,61 +61,64 @@ export default class Demo extends Component {
playing={this.state.playing}
tempo={90}
>
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{ this.visualization = c; }} />
+ {this.state.downloadLinkVisible && this.renderDownloadLink()}