So welcome back to the course.
So we're going to take a look at our fifth video, which is auto connect function or class that we've
I use frequently when loading are our TSB streams.
So let's take a look at this because it's quite useful because there's this close off the windows of
real intimacy and zoom in here.
So you can see there's this entire class here that creates basically it's a video capture class, and
it's I wouldn't go into the details of this function.
However, what it does, it basically is a function that monitors a video stream or TSP stream or any
types of stream actually coming to it.
And basically, if the feed goes down, it auto reconnects to it so you can see we we create a class
called video capture here, and we set up using the open sea view video capture function.
We've created own video capture function here with the output stream here and inside of this object
function.
It does the internal checking here to ensure that its feed is always connected.
It has a connect function, so whenever it detects that the feed goes down here, it'll try to reconnect
using that connect function.
So it's a very good, low class that's created here.
So let's just test it out.
Oops, we didn't declare this.
So what I'm going to do, I'm going to test it out by bringing down my internet connection.
I'm going to disconnect my Wi-Fi so he can see it work in action.
So it's connecting here and it's connected.
Now you can see this display, Nat, and the image is being played here since the previous streams,
but it of us who wouldn't get confused.
So now that's disconnect the internet and you can see the stream has stopped.
Now let's reconnect.
Although if I connect back to my building's internet and hopefully it will reconnect shortly, there
it goes.
So you can see it.
Auto reconnected to that video stream.
So this is an invaluable algorithm of function.
Feel whatever you want to call it, a valuable piece of code that allows us to maintain connections
to our video players.
It doesn't crash because I previously built an application web, and I naively thought this was like
three or four years ago where I naively thought that the RTP stream and the company's internet would
be reliable.
And it wasn't.
It was going down every day and required someone to restart the server.
So after a couple of hours, we just wrote up this function.
It was a function we found online, but we just made some changes to it.
And though I'm sharing it with you guys, so this is a pretty cool piece of code here.
Hopefully, we might use it in some of the applications.
Thank you for this chapter, for watching this chapter, and we'll move on now to capturing video using
screenshots.
And I'll explain to you what that is in the next section.
Thank you.