GoPro reported second-quarter results that beat analysts' expectations on Thursday.

Here's how the company did compared with Thomson Reuters consensus estimates:

Loss per share: 15 cents vs. 22 cents expected

Revenue: $282.7 million vs $270.2 million expected

The stock was up as much as 10 percent in after-hours trading before giving up those gains and turning negative.

In the year-ago quarter, GoPro reported a loss of 9 cents per share on revenue of $296.5 million. Thursday's results represent a 4.7 percent year-over-year decline in revenue. That is better than the 9 percent drop analysts had forecast.

Founder and CEO Nick Woodman said GoPro is "on track" and will be profitable in the second half of the year.

For the third quarter, the company said it expects revenue between $260 million and $280 million. Analysts had projected third-quarter revenue of $263.6 million, according to a Thomson Reuters consensus estimate.

Although GoPro's supply chain has not been affected by President Donald Trump's tariffs on Chinese goods, Woodman said on a call with investors that the company is still "actively looking" at alternative sourcing locations outside of China in the event that its current suppliers are impacted.

The stock has plunged 25 percent in the past 12 months as the company tries to reduce costs and boost sales amid growing competition.

Following a rough 2017 that forced the company to slash prices during the prime holiday shopping season, GoPro cut more than 20 percent of its global workforce in January. That same month the company decided to exit the drone market, abandoning its Karma product line. Woodman, once the highest paid CEO in the U.S., is set to receive just $1 this year after the board cut his salary and eliminated any potential bonuses.

This year GoPro has expanded its product line to stay competitive in the increasingly crowded action-camera market. The company launched an entry-level camera called HERO in March. At $199, it is the least-expensive GoPro available and closer in price to cameras sold by budget Chinese manufacturers that have gained traction in recent years.

Despite its difficulties, GoPro still dominates the action-camera market. In July, the company said it has sold more than 30 million of its flagship HERO line of cameras since the first version was launched in November 2009.