Check out Web Audio API, maybe it makes visualisation, reconnecting and other things easier or even possible