Html-файл не работает для прямой трансляции в django
В файле camera.py
class VideoCamera(object):
def __init__(self):
self.video = cv2.VideoCapture(0)
# Define the codec and create VideoWriter object
def __del__(self):
self.video.release()
def get_frame(self):
success, image = self.video.read()
ret, jpeg = cv2.imencode('.jpg',image)
return jpeg.tobytes()
**В файле view.py **
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')
def video_feed(request):
return StreamingHttpResponse(gen(VideoCamera()),
content_type='multipart/x-mixed-replace; boundary=frame')
** Мой файл url.py**
tyurlpatterns = [
path('live/',stream_views.video_feed,name='video_feed'),
И HTML файл
{% extends 'blog/base.html' %}
{% block content %}
<img src="{{ url 'video_feed' }}" alt="video_feed">
{%endblock content%}
здесь мой html файл не работает.Он просто запускает другой файл.Html файл не может получить доступ к этому url. Что я могу сделать для решения этой проблемы?
Я ожидаю, что каждый мой кадр будет постоянно переходить в мою html-страницу.