yvesgurcan / web-midi-player

🎹 Event-driven JavaScript library that enables MIDI playback in the browser
https://midi.yvesgurcan.com
MIT License
23 stars 8 forks source link

Add seek method #271

Open normaluniversity opened 3 years ago

normaluniversity commented 3 years ago

Summary

Add seek method to the library. Usage:

            let midiPlayer = new MidiPlayer({ logging: false, patchUrl: 'lib/pat/' });
            midiPlayer.setLogger({
                logging: false,
                eventLogger: function (g) { musicCurrentTime = (g.time) || 0;}
            })
           midiPlayer.play({ url: `./${url}` });
           midiPlayer.seek({ mSecond: milliSeconds });

Checklist

All the relevant tasks below must be performed in addition to automated CI/CD checks.

Issue(s) adressed

Enter the issue number of the bug(s) that this PR fixes.