Phone screen goes black when playing a video. No Auto-Lock but when I put the phone down.

Whenever I am watching a video and have my phone rotated the whole screen just goes black. It isn’t even locked as hitting be lock button does nothing. This just started happening to me randomly and I’m not sure why. Happened on YouTube and Twitch. Im on an iPhone 7 Plus on iOS 11.4.1

Edit: Solved! It was some bug with the proximity sensor. I simply hard reset the phone by holding the power and volume down button and this issue is solved. Thanks to everyone who helped.