fixed a nesting problem caused by moving the media constraints variable.