Not so long ago, China was an oasis for pirated music and videos. CDs and DVDs were easily copied and sold for cheap at roadside markets. If you had a computer and an internet connection, top selling albums and Hollywood movies were widely available for free online.

That's changing. And as is the case with many tech trends in China, it's changing fast.

New technologies and a long-running crackdown on pirated content mean members of the country's growing, smartphone-wielding middle class are increasingly willing to pay to stream videos and music online.

"When you have to spend two-to-three hours digging up pirated content, users are willing to pay a [small] amount of money to get non-pirated content," said Karen Chan, an analyst with research firm Jefferies.

Related: Spotify sued for $1.6 billion over Tom Petty, Doors songs

Workers in China earn far less on average than their U.S. counterparts. But for the better paid inhabitants of Chinese cities, streaming content is pretty affordable.

Across major Chinese video platforms, the monthly fee is about 20 yuan ($3); streaming music is even cheaper, ranging from 8 to 15 yuan ($1-$2) per month. Compare that with a basic monthly Netflix (NFLX) subscription in the U.S. at $8, or a Spotify one at $10.

'It became really easy to pay'

The rapid spread of digital payment platforms like Tencent's WeChat Pay and Alibaba-affiliated Alipay has also played a role, according to Xue Yu, an analyst with research firm IDC.

The platforms created a market of young Chinese consumers comfortable with buying goods and services for a few yuan online, Xue said.

Amber Zhang, a 27-year-old office assistant in Beijing, told CNNMoney that WeChat Pay was one of the key reasons she started spending money on music and video subscriptions back in 2013.

"It became really easy to pay," she said.

Like many other parts of China's cloistered tech industry, domestic companies are reaping most of the profits from online content while foreign firms have faced difficulties.

The video market is dominated by Tencent Video and iQiyi, a subsidiary of internet company Baidu (BIDU). The country's top ecommerce company, Alibaba (BABA), is also a big player with its video streaming platform Youku.

Related: Netflix joins the exclusive $100 billion club

Tencent (TCEHY) also has a near stranglehold on the streaming music industry through its QQ Music, KuGou and Kuwo platforms.

"These services are good enough now, it's very convenient, you can download an app on your phone, you can stream all the videos or audio that you want," said Kevin Chang, a 28-year-old engineer who lives in Beijing.

China's big tech companies dominate

The competition for paying customers like Chang is intense.

Tencent has a virtual monopoly on the streaming of mainstream western music in China. It struck a deal with Sony Music, Universal Music Group and Warner Music Group for the exclusive rights to stream their music in China. Under the deals, Tencent also gets to decide which songs rivals get to stream.

The hope is that by holding the keys to such a vast catalog, Tencent will get more users to sign up for subscriptions on its various music platforms. At the moment, it has around 15 million subscribers. It sounds like a big number, but it's only about 2% of the company's total active user base.

Video streaming has had more success -- both Tencent Video and iQiyi report about 10% of their monthly active users pony up for subscriptions (about 40 million and 30 million users respectively).

Even the Chinese users who are watching videos or listening to music for free on established platforms, are no longer doing so illegally. They generate revenue for the tech companies by sitting through ads.

Although the ads bring in money, the margins from paying subscribers are much higher, according to Chan, the Jefferies analyst.

Related: 'Handmaid's Tale' effect? Hulu grows to 17 million subscribers

Premium content is the driving force for getting people to convert to subscriptions -- if you can only watch your favorite TV show with a VIP streaming account, for example, you are more likely to subscribe to such a service.

As a result, Chinese video platforms "have to compete quite fiercely" for content, IDC's Xue said.

Some of the most coveted shows come from U.S. companies, which remain largely shut out from offering content directly to Chinese consumers in the face of heavy government censorship and regulation. Instead, they're opting to go through the big local players.

iQiyi struck a deal with Netflix in April, giving its Chinese subscribers access to popular original series like "Black Mirror," "Stranger Things" and "Mindhunter." Tencent became the exclusive online partner for HBO in China back in 2014, giving its subscribers access to hits like "Game of Thrones" and "True Detective."

Domestic players are also developing original series for the local market. Tencent Video has had a string of successes producing dramas and variety shows in house, as has iQiyi.

Related: Siri, what's that song? Apple buys Shazam

And original series give Chinese streaming platforms an even stronger incentive to respect intellectual property laws because they can now make money from their own content by selling it overseas.

Youkou produced "Day and Night," a 32-episode detective series that became a runaway success, garnering some 4 billion views since its debut in August.

It became Youkou's first Chinese internet series to be distributed overseas when Netflix snapped up the exclusive worldwide distribution rights for the show in November.

-- Serenitie Wang contributed to this report.