LOS ANGELES - Hollywood's highest-profile custody case was back in court Friday, with a lawyer for Britney Spears winning a motion to bar videotaping of depositions.

Spears and ex-husband Kevin Federline were under court order to appear later in the day at another hearing to work out custody arrangements for their two young sons.

Spears's lawyer, Thomas Paine Dunlap, argued that video of the depositions would almost certainly wind up on YouTube. He said his celebrity client had a right to be protected from that exposure.

Superior Court Commissioner Scott Gordon made his ruling in spite of his concern that she is constantly courting "an inordinate amount of media,'' which he said runs counter to her expressed desire for privacy.

Dunlap countered that the pop star was not trying to create media attention.

"If she goes to Starbucks, there's media there. If she goes shopping, there's media there,'' he said.

Lawyer Mark Vincent Kaplan, who represents Federline, said his client wanted the depositions to be videotaped to preserve the demeanour of witnesses who testify during the closed sessions.

After the commissioner's ruling, Kaplan asked that experts and other parties be allowed to be present to see how witnesses responded.

Gordon said he would allow two people to observe the witnesses.

After the ruling, the case was recessed until early afternoon, when Spears's lawyer was expected to argue that she has complied with court orders and should regain the shared custody she lost earlier this month.

In an unusual twist, a special metal detector was installed outside the courtroom. Officials were confiscating cell phones from everyone entering the floor to prevent media, attorneys and spectators from taking pictures in the courtroom.

The process caused a backup of lawyers who had to empty brief cases for inspection.

During the morning hearing, Dunlap complained that he was being forced to do things he had never done before to get into a courtroom.

Gordon responded dryly, "This may be the manufacture of your client.''

Outside the courthouse, about 40 members of the media gathered more than two hours before the afternoon hearing was set to begin, and half a dozen satellite TV broadcast trucks lined the busy, downtown street.

Reporters and photographers snacked and chatted, trying to figure out which of the several courthouse entrances the celebrities might use.

Larry Mays, 59, stood among the crowd wearing a banner reading, "Ask Jesus to Save You Now.'' He said he routinely stakes out court proceedings involving celebrities.

"The cameras help me get the message out,'' he said.

Gordon has previously said there was evidence that Spears is a "habitual, frequent and continuous'' user of drugs and alcohol, withdrew approval for her to even visit the children after finding she had failed to comply with some conditions for shared custody.

He later withdrew the ban and allowed her to visit Preston, 2, and Jayden James, 1 -- but only in the presence of a court-approved monitor.

The order by Gordon was tough and unambiguous: Spears was to undergo random drug and alcohol tests and meet weekly with a parenting coach who would report back to the court about her parenting skills.

Spears and Federline also were prohibited from making derogatory remarks about each other in their children's presence and from using "corporal punishment'' to discipline them.

Both parents also were ordered to complete the court's "Parenting Without Conflict'' class.

The custody fight has played out on a public stage, with paparazzi and celebrity Web sites reporting on the former couple's every move -- including sightings of Spears driving with her sons and a monitor in Beverly Hills.