Media playback is unsupported on your device Media caption Thousands gathered in Stockholm on Saturday to remember Swedish DJ Avicii

The death of Swedish DJ Avicii, whose supreme knack for uplifting, melodic pop-house hits made him one of the world's biggest dance producers, has left fans and fellow musicians in deep shock.

He was just 28. He headlined arenas, notched up billions of streams and worked with some of the biggest names in music, but suffered health problems and struggled with life on the road.

From the Swedish school of pop

Born Tim Bergling in Stockholm in 1989, his mother is the actress Anki Liden, who starred in Lasse Hallstrom's Oscar-nominated film My Life as a Dog.

He once said he was shaped by the Swedish pop sensibility. "We grow up singing great folk songs, so the sense of melody is good, and you grow up with that in you. I think it moulds everybody.

"But I also grew up knowing people like Eric Prydz and Swedish House Mafia were in the same neighbourhood."

It all went Pete Tong... in a good way

Fellow DJ Pete Tong spotted Avicii when he entered a talent competition a decade ago. The Swede won by a landslide and Tong released the entry - titled Manman - on his own label.

"Clearly he had a very strong talent for constructing a melody and showed great maturity in the way he put a track together," Tong told the Evening Standard in 2014. "A natural. My only regret is that I didn't sign him on a longer deal."

Image copyright Getty Images

Reaching new Levels

After making his name with a string of singles, Avicii's popularity exploded with the song Levels in 2011.

The song combines a pulsating, euphoric hook with a sample of Etta James' Something's Got a Hold on Me, and reached platinum status in at least 10 countries.

That success snowballed with dancefloor anthems like I Could Be The One with Nicky Romero and the country-tinged Wake Me Up, featuring the vocals of Aloe Blacc - both UK number one singles in 2013.

Avicii had a range of influences he could reach for, but his biggest hits had the same elements - insistent, escapist house production; guest vocals to lend accessibility and depth; and, above all, irresistible melodies.

When it was suggested that he didn't make "real music", he told the Standard: "You are drawing the melodies, drawing the chord progressions. You are making music. Mozart wrote everything down on a piece of paper. DJs write on computers. I really don't see any difference."

A superstar among DJs

The hits kept coming - in the form of songs like Hey Brother, You Make Me, The Nights and Waiting For Love.

As Billboard magazine wrote: "Even when he's being cheesy, it's the kind of cheese you wanna cover your fries in and just give yourself heartburn shoving down your own throat."

Avicii headlined festivals and became the first EDM DJ to pull off a worldwide arena tour, earning $19m in 2015, according to Forbes.

Big-name collaborations saw him work with Coldplay, Rita Ora, Sia, Lenny Kravitz, Leona Lewis and Robbie Williams. Last year, he was reported to have been working with disco legend Nile Rodgers on Chic's comeback album.

And high-profile gigs included the 2014 World Cup closing ceremony and the wedding of Sweden's Prince Carl Philip.

Image copyright Getty Images

Gigging for good causes

In 2012, the DJ embarked on a 27-date US House for Hunger tour, pledging $1m for the hunger relief charity Feeding America.

"I discovered when I started making money that I didn't really need it," he once said. "When you have such an excess of money you don't need, the most sensible, most human and completely obvious thing is to give to people in need."

He also supported other causes. In 2015, he tackled the issues of human trafficking and gang violence when he directed the videos for his tracks For a Better Day and Pure Grinding. "All the songs have a story I wanted to tell," Avicii said.

Heavy drinking and health setbacks

Avicii's health problems began in January 2012, when he spent 11 days in hospital with acute pancreatitis, reportedly caused by heavy drinking.

"Drinking became routine for me, but it's impossible to keep up touring and drinking at the same time, because you are going to crash," he told the Standard. "Especially when you are playing 320 shows a year.'

He went back into hospital in 2013 and was advised to have his gallbladder removed. He declined and continued touring, but was forced to have the surgery in 2014. Doctors discovered his appendix had ruptured, and removed that at the same time.

"I took a month off, but it wasn't really a month off," he told Billboard. "I was in the studio 12 hours a day, and then went right back to touring. It's hard to say no in this industry. You want to play everything and be everywhere."

Image copyright AFP

Touring takes its toll

Despite his health problems, the announcement in 2016 that he was retiring from touring still came as a shock.

"To me it was something I had to do for my health," he told the Hollywood Reporter. "The scene was not for me. It was not the shows and not the music. It was always the other stuff surrounding it that never came naturally to me.

"I'm more of an introverted person in general. It was always very hard for me. I took on board too much negative energy, I think."

After the announcement, he said he had got his "private life back" and was "focusing on myself for the first time in a long time".

"This was obviously the hardest decision of my life so far," he said. "But so far it has paid off tremendously in terms of well-being for me. I'm happier than I have been in a very very long time."

His final gig was in Ibiza in August 2016, and he released a comeback EP in August 2017.

Follow us on Facebook, on Twitter @BBCNewsEnts, or on Instagram at bbcnewsents. If you have a story suggestion email entertainment.news@bbc.co.uk.