Rihanna told police she heard the sound of several rounds hitting the trailer, and opened the curtains to find bullet holes in the windshield directly in front of where she was standing.
She said she got A$AP Rocky, whose real name is Rakim Mayers, out of bed and told him they were being shot at as they both ducked to the ground, before rushing inside the property to make sure their three children and staff were safe.
Police said about 20 rounds had been fired. In addition to the trailer, they hit a patio area and a nursery room wall.
Bullet holes were also found at a neighboring property, a Los Angeles Police Department crime summary said.
Deputy District Attorney Alexander Bott told Los Angeles County Superior Court the gunfire from an assault-style rifle had erupted at a time several people were at home "putting numerous lives at risk" in the March 8 incident.
He said Ortiz, who was arrested in a vehicle with a rifle, ammunition and a disguise -- a wig -- had behaved in a manner that was "extremely dangerous."
Ortiz, who is from Florida, entered not guilty pleas to one count of attempted murder involving Rihanna, whose real name is Robyn Fenty, along with 10 counts of assault with a semiautomatic firearm.