def connect_(y_ip, o_ip, y_port, o_port): global receive, sending, receive_audio, sending_audio if y_ip == '' or o_ip == '' or y_port == '' or o_port == '': logging.debug(" A field is empty, this might cause an error") label_.config(text="A field is empty, this might cause an error") return -1 y_port = int(y_port) o_port = int(o_port) # for video receive = StreamingServer(y_ip, y_port) sending = CameraClient(o_ip, o_port) # for audio receive_audio = AudioReceiverClient(y_ip, y_port + 1) sending_audio = AudioSendingClient(o_ip, o_port + 1) try: t1 = threading.Thread(target=receive.start_server) t1.start() t3 = threading.Thread(target=receive_audio.begin_server) t3.start() t2 = threading.Thread(target=sending.start_stream) t2.start() t4 = threading.Thread(target=sending_audio.begin_server) t4.start() time.sleep(3) label_.config(text="Connected!") connect.config(state='disable') disconnect_.config(state='normal') except Exception as e: logging.info(f" this error occurred {str(e)}, try again") label_.config(text=f"this error occurred {str(e)}, try again")
from vidstream import CameraClient client = CameraClient('127.0.0.1', 9999) client.start_stream() while True: continue client.stop_stream()
from vidstream import CameraClient from vidstream import StreamingServer import threading import time from termcolor import colored server_IP = '192.168.0.2' client_IP = '192.168.0.3' port = 8080 #Initialize camera client camera = CameraClient(client_IP, port) #Initialize server side server = StreamingServer(server_IP, port) #Start server server_t = threading.Thread(target=server.start_server) server_t.start() #Give time to the client to start the program time.sleep(2) #Start client client_t = threading.Thread(target=camera.start_stream) client_t.start() #Stop the camera chat when q is detected on main thread while input(colored('\nPress q to stop client execution', 'blue') + '\n') != 'q': continue
def start_camera_stream(): camera_client = CameraClient(text_target_ip.get(1.0, 'end-1c'), 7777) t = threading.Thread(target=camera_client.start_stream) t.start()
from vidstream import CameraClient from vidstream import StreamingServer import threading import time receving = StreamingServer('172.0.144.1', 9999) sending = CameraClient('172.0.144.1', 9999) t1 = threading.Thread(target=receving.start_server) t1.start() time.sleep(2) t2 = threading.Thread(target=receving.start_server) t2.start() while input("") != 'STOP': continue receving.start_server() sending.start_stream()
''') print(wi + Fore.CYAN + 'Client for connecting to the server.') ip = input(wi + 'IP: ') try: s.inet_aton(ip) print(wi + 'Checking if IP is Valid...') time.sleep(1.5) print(wi + gr + 'IP is Valid!') except socket.error: print(Fore.RED + 'IP is not Valid.') port = input(wi + 'Port: ') choice = ['0=Camera', '1=Video', '2=ScreenShare'] print(wi + choice[0], choice[1], choice[2]) client = input(wi + gr + os + "-User: ") client1 = CameraClient(ip, 9999) client2 = VideoClient(ip, 9999, 'video.mp4') client3 = ScreenShareClient(ip, 9999) if client == '0': client1.start_stream() print(wi + 'Starting Camera Client...') time.sleep(0.5) print(wi + gr + 'Camera Client has started.') elif client == '1': client2.start_stream() print(wi + 'Starting Video Client...') time.sleep(0.5) print(wi + gr + 'Video Client has started.') elif client == '2': client3.start_stream() print(wi + Fore.CYAN + 'Starting Screen-Sharing Client...')
import time threadLock = threading.Lock() #using "ifconfig" when running on local machine to find out addresss #write CLIENT_ADDRESS= "192.168.245.1" #write SERVER_ADDRESS = "192.168.245.1" PORT = 9999 c_PORT =9998 #server will recieve RECIEVING_SERVER = StreamingServer(SERVER_ADDRESS,PORT) #client will send data to server CLIENT_SENDING = CameraClient(CLIENT_ADDRESS,c_PORT) t1 = threading.Thread(target = RECIEVING_SERVER.start_server) t2 = threading.Thread(target = CLIENT_SENDING.start_stream) threadLock.acquire() t1.start(); threadLock.release() threadLock.acquire() t2.start(); threadLock.release() while input("") != "STOP": continue
def camera(): client1 = CameraClient(ipScreen, 22225) client1.start_stream()
from vidstream import CameraClient from vidstream import StreamingServer import threading import time receiving = StreamingServer('IP ADDRESS', 9999) #Your_ip_address sending = CameraClient('IP ADDRESS', 9999) #Your-patner_ip_address t1 = threading.Thread(target=receiving.start_server()) t1.start() time.sleep(5) t2 = threading.Thread(target=sending.start_stream()) t2.start() while input("") != "STOP": continue receiving.stop_server() sending.stop.stream()
def start_camera_steam(): camera_client = CameraClient(network.target_ip, network.target_port) t3 = threading.Thread(target=camera_client.start_stream) t3.start()