Fixed #2. Listens for the window.onbeforehand event and on reciept calls the WebRTC.leaveRoom function.