:blackhat: hello ladies and Gents i am having an issue well a few to be exact 😖 and i would like some assistance.
first my code:
i would like to have 2 pages index.html and view.html where if a user visits the route index.html a video stream of their webcam is sent to view.html which another user can see. also i would like to make it so that if another person goes to index.html their video stream is also sent to view.html and allows a person to be able to view both video streams.
my second issue is that of latency
first my code:
PHP Code
<?php
from flask import Flask, render_template, Response
from camera import VideoCamera
from flask_ngrok import run_with_ngrok
import time
app = Flask(__name__)
#run_with_ngrok(app)
def gen(camera):
while True:
frame = camera.get_frame()
yield (b'--frame\r\n'
b'Content-Type: image/jpeg\r\n\r\n' + frame + b'\r\n\r\n')
@app.route('/video_feed')
def video_feed():
return Response(gen(VideoCamera()),
mimetype='multipart/x-mixed-replace; boundary=frame')
@app.route('/')
def index():
return render_template('index.html')
@app.route('/view')
def admin():
return render_template('view.html')
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000)
i would like to have 2 pages index.html and view.html where if a user visits the route index.html a video stream of their webcam is sent to view.html which another user can see. also i would like to make it so that if another person goes to index.html their video stream is also sent to view.html and allows a person to be able to view both video streams.
my second issue is that of latency
Code
camera.pyPHP Code
<?php
import cv2
class VideoCamera(object):
def __init__(self):
self.video = cv2.VideoCapture(0)
self.video.set(3, 320)
self.video.set(4, 240)
def __del__(self):
self.video.release()
def get_frame(self):
success, image = self.video.read()
ret, jpeg = cv2.imencode('.jpg', image)
return jpeg.tobytes()

