-
Notifications
You must be signed in to change notification settings - Fork 1
/
main2.py
56 lines (41 loc) · 1.76 KB
/
main2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
from requests.api import get
from vidstream import *
import tkinter as tk
import socket as sok
import threading as thr
local_ip_adress = sok.gethostbyname(sok.gethostname())
server = StreamingServer(local_ip_adress, 7777)
receiver = AudioReceiver(local_ip_adress, 6666)
def start_listening():
t1 = thr.Thread(target=server.start_server)
t2 = thr.Thread(target=receiver.start_server)
t1.start()
t2.start()
def start_camera_stream():
camera_client = CameraClient(text_target_ip.get(1.0, 'end-1c'), 9999)
t3 = thr.Thread(target=camera_client.start_stream)
t3.start()
def start_screen_sharing():
screen_client = ScreenShareClient(text_target_ip.get(1.0, 'end-1c'), 9999)
t4 = thr.Thread(target=screen_client.start_stream)
t4.start()
def start_audio_stream():
audio_sender = AudioReceiver(text_target_ip.get(1.0, 'end-1c'), 8888)
t5 = thr.Thread(target=audio_sender.start_stream)
t5.start()
window = tk.Tk()
window.title("Python Zoom Clone")
window.geometry('300x200')
text_target_ip = tk.Text(window, height=1)
text_target_ip.pack()
label_target_ip = tk.Label(window, text="Target Ip:")
label_target_ip.pack()
btn_listen = tk.Button(window, text="Eshitishni boshlash", width=50, command=start_listening)
btn_listen.pack(anchor=tk.CENTER, expand=True)
btn_camera = tk.Button(window, text="Camerani yoqish", width=50, command=start_camera_stream)
btn_camera.pack(anchor=tk.CENTER, expand=True)
btn_screen = tk.Button(window, text="Screen qilish", width=50, command=start_screen_sharing)
btn_screen.pack(anchor=tk.CENTER, expand=True)
btn_audio = tk.Button(window, text="Audio yozish", width=50, command=start_audio_stream)
btn_audio.pack(anchor=tk.CENTER, expand=True)
window.mainloop()