Spaces:
Runtime error
Runtime error
import cv2 | |
class VideoPlayer: | |
def play_video(self, video_path): | |
cap = cv2.VideoCapture(video_path) | |
while cap.isOpened(): | |
ret, frame = cap.read() | |
if ret: | |
cv2.imshow('Video', frame) | |
if cv2.waitKey(60) & 0xFF == ord('q'): | |
break | |
else: | |
break | |
cap.release() | |
cv2.destroyAllWindows() | |