With the money from CDs and digital downloads disappearing, the music industry has pinned its hope for the future on online song streaming, which now accounts for the majority of the $7.7 billion U.S. music market.

But the biggest player in this future isn’t one of the names most associated with streaming — Spotify, Amazon, Pandora or Apple. It’s YouTube, the site best known for viral videos, which accounts for 25 percent of all music streamed worldwide, far more than any other site.

Now, YouTube is locked in an increasingly bitter battle with music labels over how much it pays to stream their songs — and at stake is not just the finances of the music industry but also the way that millions of people around the world have grown accustomed to listening to music: free of cost.

Music labels accuse YouTube of using a legal loophole to pay less for songs than traditional music-streaming sites, calling YouTube the biggest threat since song piracy crippled the industry in the early 2000s. The industry has pressed its case to regulators around the world in hopes of forcing a change.

“I do think YouTube is starting to panic a little bit,” said Mitch Glazier, president of the Recording Industry Association of America.

But YouTube is not backing down, stressing the benefits to musicians of promotion on one of the Web’s most popular sites — which allows ordinary users to integrate music into their uploads. YouTube also warns against attacks that could reduce competition among streaming services.

“The industry should be really, really careful because they could close their eyes and wake up with their revenue really concentrated in two, three sources,” said Lyor Cohen, YouTube’s global head of music, referring to Spotify, Apple Music and Amazon Prime Music. (Amazon founder Jeffrey P. Bezos owns The Washington Post.)

The music industry counters they are backed into a corner when negotiating with YouTube — a unit of Google-parent Alphabet — which is mostly shielded by federal law from being responsible for what users post on the site.

“It isn’t a level playing field,” said one executive at a major music label who spoke on the condition of anonymity because he wasn’t authorized to talk, “because ultimately you’re negotiating with a party who is going to have your content no matter what.”

Now, the battle is heating up as the European Union is expected to release new rules later this year for how services such as YouTube handle music, potentially upending some of the copyright protections that undergird the Internet.

Online streaming works like a digital jukebox, with fractions of a penny paid each time a song is played. The money comes from ads and subscriptions.

The E.U. has formally recognized that there is a “value gap” between song royalties and what user-upload services such as YouTube earn from selling ads while playing music. YouTube is by far the largest user-upload site.

How such a law would address the gap is still being decided, but the E.U. has indicated it plans to focus on ensuring copyright holders are “properly remunerated.”

Even the value gap’s existence is disputed.

A recent economic study commissioned by YouTube found no value gap — in fact, the report said YouTube promotes the music industry, and if YouTube stopped playing music, 85 percent of users would flock to services that offered lower or no royalties.

A different study by an independent consulting group pegged the YouTube value gap at more than $650 million in the United States alone.

“YouTube is viewed as a giant obstacle in the path to success for the streaming marketplace,” Glazier said.

The dispute boils down to what YouTube pays for songs.

Musicians from Arcade Fire to Garth Brooks to Pharrell Williams say they earn significantly less when their songs are played on YouTube than on a site such as Spotify — even though many listeners use these services in the same way. Both YouTube and Spotify allow users to search for music and find song recommendations. On YouTube, users can find music alongside cat videos and toy reviews in what is generally a free-for-all of content, while people go to Spotify and the like for a more refined experience. Some audiophiles argue the sound quality on music streaming sites is superior.

YouTube pays an estimated $1 per 1,000 plays on average, while Spotify and Apple music pay a rate closer to $7.

Irving Azoff, the legendary manager for acts such as the Eagles and Christina Aguilera, said he has one artist — whom he declined to name — who gets 33 percent of her online streams from YouTube but only 10 percent of her streaming revenue.

Smaller acts see it, too. Zoe Keating, an instrumental cello player, showed The Washington Post a statement from YouTube showing that she earned $261 from 1.42 million views on YouTube. In comparison, she earned $940 from 230,000 streams on Spotify.

“YouTube revenue is so negligible that I stopped paying attention to it,” Keating said.

YouTube admits that it pays less for songs.

But the reason for this disparity is where the two sides split.

The music industry claims YouTube has avoided paying a fair-market rate by hiding behind broad legal protections. In the United States, that’s the “safe harbor” provision, which essentially says YouTube is not to blame if someone uploads a copy-protected song —unless the copyright holder complains.

This, the music industry argues, leads to a costly game of “Whac-A-Mole”: hunting for illicit song uploads and filing notices with YouTube.

“You can’t prevent something from going up on YouTube. All you can do is ask them to take it down,” said Stephen Carlisle, who runs the copyright office at Nova Southeastern University. “At some point, it’s not worth it to do this.”

YouTube says it has the solution: Its Content ID system automatically checks for violations by comparing songs detected in new uploads against a database of claimed songs, capturing 99.5 percent of complaints. The company says it averages fewer than 1,500 traditional copyright claims from the music industry a week.

YouTube also pointed out that it has licensing deals with music labels large and small.

Earlier this year, Warner Music Group — one of the “big three” music labels — signed a new licensing deal with YouTube, and a memo from Warner chief executive Steve Cooper leaked out, saying the deal was signed “under very difficult circumstances.”

“There’s no getting around the fact that, even if YouTube doesn’t have licenses, our music will still be available but not monetized at all,” the memo continued.

Warner confirmed the memo’s authenticity, but, like the other major labels, declined to comment for this article.

Cooper’s complaints surprised Cohen, who worked at Warner until leaving for YouTube last year.

“I never heard that from his mouth during the entire negotiation,” Cohen said.

Cohen’s move to YouTube created waves in the industry. After all, Cohen was famous for taking one of the hardest stands against YouTube when, in 2008, he pulled Warner’s entire song catalogue from the video service to protest low song royalties. It was the nuclear option.

And it failed. After nine months and spending $2 million trying to keep its music off YouTube, Warner capitulated.

Cohen said he was sympathetic to his former colleague’s complaints. But YouTube pays $1 billion in song royalties worldwide each year. Cohen said his company has been hindered by its global reach — ad rates are lower outside the United States — and its slower rollout of a subscription option, YouTube Red. Song royalties are higher with monthly subscriptions than ads.

“What I’m trying to do with YouTube is be a cheerleader to build a subscription business that the industry can be proud of,” Cohen said.

Nabila Hisham, 22, is a music fan on YouTube. Recently, the college student in Kuala Lumpur, Malaysia, has been playing one song repeatedly: “Despacito,” a chart-topping Latin pop remix featuring Justin Bieber. The YouTube video — which has a total of 412 million plays — is a photo of Bieber’s tattooed neck. The video is beside the point. For, Hisham, it’s about the music.

“I’m glad that YouTube exists,” she said.

Correction: A previous version of this story stated YouTube’s ContentID system automatically handles 98 percent of copyright management for songs. The system handles 99.5 percent.

Todd C. Frankel is an enterprise reporter on The Washington Post's Financial desk, covering people and policy. He joined The Washington Post in 2014 and previously worked as a reporter at newspapers in St. Louis; Everett, Wash.; and Charleston, W.Va.