OneRepublic frontman Ryan Tedder says he has been making music, doing a cooking show and interacting with fans to keep him sane while in quarantine due to COVID-19.

The singer appeared as a guest on Miley Cyrus' daily Instagram Live talk show, "Bright Minded" on Thursday, where he shared how he kept himself busy and sane while in quarantine. He shared that interacting with others online has kept him from freaking out.

"I swear to God that interacting has kept my sanity. It's just making music and reaching out, just what you're doing, this is what has kept me sane," Tedder told Cyrus.

Likewise, he recalled the first time he decided to go into isolation after he learned that his friend and publicist tested positive for COVID-19. He shared that his friend, whom he shared pizza with and spent an entire night with, texted him from the hospital about his condition.

"He's like, 'Mate, I'm so sorry but you need to go straight to a doctor, you need to get tested. I have coronavirus and it sucks. I'm in the hospital.'" Tedder added that his publicist, whom he spent a day with, also contracted the disease. When he learned about their condition, he immediately called his doctor and was told not to go home to his wife and kids but head straight to his studio.

View this post on Instagram

@antoni, @iammarkronson, @ryantedder, @ilsey

A post shared by Miley Cyrus (@mileycyrus) on

The 40-year old remembered feeling emotional on the first three days while in quarantine, because he had already been away from his family for two weeks. OneRepublic had been on tour when they learned about the COVID-19 outbreak in Italy, and they had to cancel their Milan show.

"And then on the third day, I snapped and I was like, you know what, screw this, let's do live concerts every night for free, let's do a cooking show. I'm going to start quarantine cuisining every night. I love to cook and let's connect with the rest of the world," Tedder said, and shared that he also freaked out about how long he had to be in quarantine.

But then, he looked at the bright side and used his time in quarantine to create music. Thus, "Better Days" happened and the track became an instant hit. Proceeds will go to MusiCares' COVID-19 relief efforts.

Aside from Tedder, Cyrus also invited Mark Ronson and Antoni Porowski to Thursday's episode. The day before, she had Dua Lippa, Bebe Rexha and Reese Witherspoon as her guests.

OneRepublic's Ryan Tedder
OneRepublic frontman Ryan Tedder, who has written for both Adele and Beyonce, tells critics to stop comparing the singers Bryan Bedder/Getty Images