refactor webrtc plugin