The fourth-year pupils from James Gillespie’s High School are thought to have been messing about when one boy threw a shoe, which dislodged a panel in the ceiling and revealed the camera.
Police were called to the scene yesterday afternoon and are now looking into how the camera got there.
Parents of the pupils concerned – aged 15 and 16 years-old – have been informed about the discovery.
It is not known whether the camera was connected to a recording device or whether it was active as the boys were changing.
It is understood the boys were at Meadowbank for a regular PE session.
A source told the Evening News: “The boys were mucking about in one of the changing rooms.
“A shoe hit a ceiling tile and exposed a hidden camera. It was obviously there for anyone using the changing rooms.
“But no-one knows how long it’s been there.”
The source added: “The person who put it there may have made a hole in the ceiling tile and pointed the camera through it and anyone who noticed a hole would just have assumed it was wear and tear.”
Meadowbank sports centre is run by city council arms-length company Edinburgh Leisure.
A spokeswoman for Edinburgh Leisure confirmed that an inquiry into the discovery was under way.
She said that the changing rooms had been sealed off while police officers collected evidence.
The spokeswoman added: “The police are investigating an incident which occurred earlier yesterday afternoon, and all necessary precautions are being taken to ensure it remains an isolated incident. The changing rooms were dual-use rooms and are currently cordoned off, pending police investigation.”
She said she could not discuss any further details while the investigation was taking place.
A spokesman for the city council said: “We are assisting Police Scotland with their inquiries.”
Police Scotland confirmed that they were investigating the incident after being called just after 3.30pm yesterday.
In 2012, an area of Meadowbank sports centre was screened off from public view after concerns about perverts taking pictures of children.
Stadium bosses admitted fitting opaque glass to a viewing gallery to stop members of the public being able to see the area, which was used for youngsters’ gym classes.