I am currently working on a “netflix party” project and I finished working on the chat part. Now my task is to add options to create a room or join a room, and in every room there will be a host and guests who can watch the current streamed video, and only the host can pause/play the video. the videos will be stored in a database, and the host will choose which video will be played, and then if a guest joins, he will watch the video right from where the video is currently at. For now I just want to be able to send the video+audio parts synchronized, and I’m trying to create a tkinter frame that will have a place for the video and a place under the video for the chat. Does anyone have any idea on how to send the video+audio in parts and making sure it will all be synchronized with the other users?
from tkinter import *
from PIL import ImageTk, Image
from enc_proj import *
import cv2
import numpy
root = Tk()
main_label = Label(root)
main_label.grid()
# Capture from camera
cap = cv2.VideoCapture("video.mp4")
# function for video streaming
def video_stream():
ret, frame = cap.read()
cv2image = cv2.cvtColor(frame, cv2.COLOR_BGR2RGBA)
img = Image.fromarray(cv2image)
tk_img = ImageTk.PhotoImage(image=img)
main_label.configure(image=tk_img)
main_label.tk_img = tk_img
main_label.after(20, video_stream)
video_stream()
root.mainloop()
What I mean is how can I send the video parts using sockets and this code?