Timothée Chalamet's old YouTube videos were his golden ticket to booking the role of Willy Wonka in "Wonka."

"Wonka" director Paul King revealed this week in an interview with Rolling Stone that the 27-year-old actor was his first choice to play the eccentric confectioner. The filmmaker said he was drawn to Chalamet in part because of old footage he had seen online of the "Call Me by Your Name" and "Dune" star performing in school productions.

"It was a straight offer because he's great and he was the only person in my mind who could do it," King told Rolling Stone.

"But because he's Timothée Chalamet and his life is so absurd, his high school musical performances are on YouTube and have hundreds of thousands of views. So I knew from stanning for Timmy Chalamet that he could sing and dance really well."

King made no mention, however, of what is perhaps the most viral dance video of Chalamet on the internet: a clip of the Oscar nominee performing an original rap years ago at a talent show under the stage name Lil' Timmy Tim.

It's unclear if Chalamet channeled Lil' Timmy Tim and his smooth dance moves at any point while portraying Wonka, but King did suggest that a strong performance background was key to nailing the part.

"I knew that was in his arsenal, but I didn't know how good he was," King continued.

"When I spoke to him, he was quite keen. He'd done tap dancing in high school and he was like, 'I'd quite like to show people I can do that."

On Monday, Warner Bros. released the trailer for "Wonka," in which Chalamet's charming chocolatier inspires his local community by opening a dazzling, experimental chocolate factory. Among the supporting cast of the fantasy film are Calah Lane, Keegan-Michael Key, Paterson Joseph, Matt Lucas, Mathew Baynton, Sally Hawkins, Rowan Atkinson, Jim Carter and Olivia Colman.

"Wonka" — a cinematic prequel of sorts to Roald Dahl's "Charlie and the Chocolate Factory" — opens in theaters Dec. 15.

©2023 Los Angeles Times. Visit latimes.com. Distributed by Tribune Content Agency, LLC.