reactjs - 'Play' is not defined when using audio library with create-react-app -
i using utility, ciseaux aids in chopping audio files. trying basic example working create-react-app encountering "failed compile" error stating 'play' not defined no-undef
. i'm not sure issue is?
heres code component:
import react, { component } 'react'; import ciseaux 'ciseaux/browser'; // audio file import bass './munchiesbassloop3.wav'; //const ciseaux = require("ciseaux/browser"); //const play = window.play; export default class tape extends component { constructor(props) { super(props); } componentdidmount() { this.makebufferstuff(); } makebufferstuff() { console.log('begin function'); ciseaux.context = new audiocontext(); // create tape instance url ciseaux.from(bass).then((tape) => { console.log('create tape instance'); // edit tape tape = ciseaux.concat([ tape.slice(10, 1), tape.slice(2, 3) ]).loop(4); // render tape audiobuffer return tape.render(); }).then((audiobuffer) => { play(audiobuffer); console.log('play'); }); } tape() { return ( <audio controls="controls"> <source src={bass} type="audio/wav" /> </audio> ); } render() { return this.tape; } }
Comments
Post a Comment