00:01
In this method, we have to write a code in python.
00:10
So we have to write a server program in python that will run the command line that is python server .py and we have to make a client python program that will run from the command line that is python p client .py.
00:42
So this is the server program and this is the client program.
01:12
So using the aortic built -in top -socketing signal, we have to create these two client servers programs.
01:24
So let us see how we will be doing this as a lot of questions and scenarios are given to us in the question itself.
01:33
So we will just start with the server1 program.
01:41
So first we have to import the necessary files that are required.
01:46
So here in this case, we are mentioning these that is asyncqtp2 numpy as nm.
01:53
So then we will represent a ball track stream that is there.
01:59
So this class we will represent a continuous stream of frames where a ball will bounce across the screen.
02:06
So for that we will be using this class.
02:12
We will initialize and these are certain parameters as you can see.
02:19
So the draw frame method here it updates the ball's position and it checks for collision within the walls.
02:31
So for that we will be using a shrink ball draw frame method.
02:39
So as you can see here the draw frame method here, it updates the ball's position then checks for collisions with the balls and draws the ball on a black frame.
02:54
So the run function here it sets it will set an rtp server.
03:04
So for that we will look in the further ahead.
03:11
So the frame here the draw frame here it as you can see is having certain parameters such as self height self width.
03:20
So it will help to update the ball position then to check the ball collision with walls.
03:27
We have to use this method that is given here and also to draw the ball on the frame.
03:33
We are using cv2 .circle to do that.
03:35
So this will finally return our frame that we have defined here.
03:40
Now the next as i told you of you are using the run function that will set up a rtc peer connection.
03:48
So we will use a run function in such a way.
03:54
Now as you can see it will represent the it will set up the rtc peer connection and it will handle the signaling between the server and the client.
04:07
So the server here creates an offer using the pc .createoffer...