AirPlay stops when phone is locked
So i’ve been having this annoying problem, when i AirPlay a video from photos app to my Samsung Smart TV the video works fine but when i lock my phone the AirPlay stops or sometimes the video gets paused and the only way to continue watching is to unlock the phone, and I can’t keep my phone on throughout the whole video/movie, i tried to let the phone automatically lock according to some people who had this problem but it didn’t fix it, any help? Or is it supposed to pause/stop AirPlay when my phone is locked, if it is, is there’s a way where i can play a video from the phone the TV without facing this problem? Also just to let you know im using an iPhone 12 Pro, Thanks.