As long as the consoles have some add-on or built-in way to play physical games it won't end until said console no longer gets games. PS6 and Xbox 5 have a good chance of a disc drive add-on to play older games and potentially support a handful of native games. Physical games will mostly die out in the 2030s, though.
For movies? Mainstream physical media (DVD, Blu-ray, UHD Blu-ray) will probably die out in wide releases in the 2030s, maybe the early 2040s. There will be so many leftover DVDs in particular for people to use that we'll still see DVD releases (even limited ones) for decades. There are still blank VHS tapes out there that people use to make very limited quantities of small films.
Lifetime Sales Predictions
Switch: 161 million (was 73 million, then 96 million, then 113 million, then 125 million, then 144 million, then 151 million, then 156 million)
PS5: 115 million (was 105 million) Xbox Series S/X: 48 million (was 60 million, then 67 million, then 57 million)
PS4: 120 mil (was 100 then 130 million, then 122 million) Xbox One: 51 mil (was 50 then 55 mil)
3DS: 75.5 mil (was 73, then 77 million)
"Let go your earthly tether, enter the void, empty and become wind." - Guru Laghima