Integration with django
saileshkush95 opened this issue · 1 comments
saileshkush95 commented
I can able to generate mpd and m3u8 file , but i didnt know how to serve these file using django views.
#I tried this approach but this is not working
def stream_multi_quality_video(request):
video_path = "./dashpath/dash.mpd"
with open(video_path, "rb") as mpd_file:
mpd_contents = mpd_file.read()
# Set the response headers
response = HttpResponse(mpd_contents, content_type="application/dash+xml")
response["Content-Length"] = len(mpd_contents)
return response
after this I got chunk file not found error in console.
Here is my frontend code for videojs
<div class="video-container">
<video id="my-video" class="video-js" controls preload="auto" width="640" height="264"
data-setup="{}">
<source src="{% url 'stream_video' %}" type="application/dash+xml">
</video>
</div>
<script>
var player = videojs('my-video');
</script>
Is there anythings I'm missing
aminyazdanpanah commented
See the page below:
https://docs.djangoproject.com/en/4.2/howto/static-files/