adds initializeMediaForType function to perform initialization of any media types instead of duplicating code