put media stream in global scope so that it can be passed into record() function