Need a python pyqt expert to solve a small bug

Job ID: 33075810

Budget: ₹600 – ₹1,500 INR

check this question of mine on StackOverflow.
https://stackoverflow.com/questions/68168379/rtsp-streaming-not-starting-automatically-in-pyqt5-qmediaplayer
I am showing live stream of RTSP URL in python Qmediaplayer and QWidget using the above mentioned code. Its running and displaying feed perfectly. But I need help in following 2 problems

1. I need to detect if the stream is running or has stopped.
Sometimes camera stops in between, I need to keep monitoring if stream is still buffering/fps are more than 0 or by any means stream is still running or not. If it stops, then I want to display a jpg file that the camera has stopped, and then when the camera starts, it must re-play the stream again automatically.
2. Sometimes the camera starts giving bad frames in between. I don't want to show bad frames. it must show only good frames.
Related categories: .NET C# Programming MVC ASP.NET Microsoft SQL Server