A middle ear infection or inflammation of the middle ear happens when a virus or bacteria inflames the area behind the eardrum. This is also known as otitis media and is most common in children.