LONDON — If you type "London" and "drone" into YouTube you'll find hundreds of videos uploaded by drone enthusiasts, from drone selfies to flyovers of the city's green spaces, but from Wednesday users have a new code to follow, which explains in simple language how to fly within the law.

The "Dronecode," launched by the Civil Aviation Authority (CAA), NATS, the UK's global air traffic management company, and the pilots union BALPA, coincides with Drone Safety Day and introduces simple rules people must follow to avoid prosecution.

What's in the code?

The code says drone operators must always have the drone they're flying in their line of sight and they must not fly it any higher than 400 feet (121.92 metres). It also says drones should never be flown near aircraft, helicopters, airports or airfields.

What about drones with cameras?

If you have a camera on your drone you can't fly it within 164 feet (50 metres) of people, vehicles, buildings or structures, according to the code. It also says you can't fly over "congested areas" or "large gatherings" such as concerts or sports events.

What happens if people breach the code?

The CAA said in a statement that "recklessly endangering" an aircraft in flight is a criminal offence and that anyone convicted of it faces a custodial sentence.

Last year, a drone pilot was fined £800 and ordered to pay costs of £3,500 after being prosecuted by the CAA for flying a drone or unmanned aerial vehicle within 50 metres of the Jubilee Bridge on the Walney channel and flying over the BAE System nuclear submarine-testing facility. In another case, a 41-year-old man was arrested for flying a drone over a football stadium during the Manchester City's home game with Tottenham Hotspur.

Why is it being introduced now?

There have been a number of serious incidents involving drones and commercial airlines at airports that prompted this new code. Last month, the Express reported details of an incident from March when a small drone flew within 50 feet (15 metres) of an Airbus A320 as it made its final descent into Heathrow. The pilot was concerned about how close it was to the aircraft and worried for the safety of the plane. It was just one of six serious incidents involving drones, with others recorded at Norwich, Southend and Leeds Bradford airports.

“We want to embrace and enable the innovation that arises from the development of drone technology, but we must ensure that this is done safely, with all airspace users in mind," CAA's Director of Policy Tim Johnson said in a statement launching the new code.

“Drone users must understand that when taking to the skies they are entering one of the busiest areas of airspace in the world - a complex system that brings together all manner of aircraft including passenger aeroplanes, military jets, helicopters, gliders, light aircraft and now drones."

Along with the new code, the CAA also launched more online resources for people who fly drones in UK airspace.