Merge "Simplify the media button handling logic"