Millennial Media has long faced competition for advertising dollars from entrenched giants like Google and Apple, but it was another household name — Facebook — that took a bite out of the Baltimore company's earnings and sent its stock plummeting last week.

The social network took the Baltimore-based company by surprise, grabbing a share of its customers who buy ads on mobile devices to drive downloads and draw users to their smartphone and tablet applications, analysts said. That contributed to a tripling of Millennial's first-quarter losses, announced Wednesday.

The results spooked investors and, overnight, Millennial's stock lost more than third of its value. After starting the week over $6 a share, it closed Friday at $3.38.

As Facebook moves to tap further into the large and growing pool of people who browse their news feeds on mobile devices, Millennial could face more problems, analysts said. The competition could test a key proposition for Millennial — that it's stronger because it is independent from the tech giants against which it competes.

The challenges also come as Millennial faces surprising executive turnover and plans a headquarters expansion that seeks to put a more permanent mark on the Canton neighborhood it calls home.

CEO Michael Barrett remained upbeat on a conference call last week with investors, laying out a strategy to diversify the company's streams of business.

But analysts said the unexpected surge in competition might prove that it will be easy for Facebook, Google and others to be as successful selling ads on mobile devices as they have been on the traditional Internet.

"I don't think anyone saw that portion of [Millennial's] business migrating away so quickly," said Andrew McNellis, vice president for equity research at Evercore Partners in New York.

Founded in 2006, Millennial pioneered mobile advertising, seeking to help app developers make money from their games, tools and other creations, and to help advertisers reach the smaller screens increasingly found in pockets and purses.

While Google has a clear path to dominate ads placed when users search the Web from their devices and Apple has easy reach to developers building apps for its ubiquitous iPhones and iPads, Millennial has stressed that its strength lies in not being aligned with any single Web portal or family of devices.

Instead, it attacks the mobile advertising business from both sides, connecting a long list of name-brand advertisers with a large swath of visual real estate on apps and mobile websites. Without any loyalty to any given operating system, Millennial offers advertisers access to a broad inventory of advertising space that is spread across a fragmented landscape of varying types of devices.

But analysts speculated that given Facebook's tremendous audience, it might be all too easy and worthwhile for brands that already advertise on the social network to extend that marketing to its mobile apps.

"As Facebook builds out their mobile program, it was easy for brands to evolve with Facebook and start investing in mobile," said Cathy Boyle, a senior analyst with eMarketer in New York. "It's a natural flow to continue to invest."

Facebook declined to comment, but a spokeswoman cited statistics that demonstrate its growth and potential in mobile advertising: One billion people use Facebook each month on mobile devices, a third more than a year ago. Through the first quarter of this year, 59 percent of its advertising revenue came from mobile, up from 45 percent for all of 2013 and 11 percent for 2012.

Google and Facebook helped drive a doubling of mobile advertising spending in 2013, according to eMarketer, from $9 billion to $18 billion. Google accounted for about half of that market, while Facebook took 17.5 percent and Millennial Media 0.8 percent.

In Millennial's first-quarter earnings conference call Wednesday, Barrett said he doesn't expect Facebook to absorb all of the opportunities.

"We think Facebook will be a strong competitor, but I don't think this is a winner-take-all in the supply side," said Barrett, referring to the pool of app developers looking to sell ad space. "It's a winner by a few, by a handful, and we'll be one of those companies."

Its stock price fell from a close of $5.35 Wednesday afternoon, before it announced a $12 million first-quarter loss, to open more than $2 lower the next day. The stock has lost about 85 percent of its value since its $133 million initial public stock offering in March 2012.

Financial news outlets including the Motley Fool and 24/7 Wall Street, meanwhile, highlighted concerns about the company's announcement that Chief Financial Officer Michael Avon would step down this summer. The departure followed that of company founder Paul Palmieri, who stepped aside as CEO in January to join venture capital firm New Enterprise Associates.

But Barrett stressed that given growth ahead in mobile, opportunities remain.

The mobile ad market is forecast to grow 75 percent in 2014, according to eMarketer. And the app download advertising business in which Facebook and Millennial are going head-to-head should be part of that, Boyle said.

"Any app developer needs to consider paid advertising at some point," Boyle said. "To be found organically in the app store is just getting harder and harder."

Still, Barrett acknowledged the company will need to go forward with care. It is in the process of a $10 million expansion of its Canton headquarters, to be renamed the Millennial Media Center at the Can Company. The company earlier this year signed a lease to stay there for a decade.

"The mobile space is, to say the least, dynamic and growing," Barrett said in the conference call. "I also realize we have some significant work to do."

Millennial Media shares tumbled 40 percent at the opening bell Thursday on news that its losses more than tripled in the first three months of 2014, despite a 47 percent surge in revenue year-over-year.

Millennial Media lost $3.8 million despite a surge to $96.7 million in revenue in the fourth quarter of 2013, with both results beating analysts' expectations, but shares fell in after-hours trading on shaky expectations going forward.

The morning after the city broke out in riots on April 27, T. Rowe Price Group CEO James A.C. Kennedy sent an email to Baltimore Deputy Mayor Colin Tarbert. Attached were two tweets, one calling for protests at T. Rowe and other major downtown businesses, and another saying "imagine if" rioters...

Maryland Live gave away a licensed replica of the Batmobile from the '60s-era "Batman" television series this spring. At 10:04 p.m. Friday, it held a drawing for a replica of the DeLorean time machine from the "Back to the Future" movies.