Extended media detection with custom function