I want to play a mp4 file in my computer using django. It is in "C:/Python25/Lib/site-packages/django/bin/script_search/output.mp4" But it doesn't work. The web browser, coolnovo, doesn't display the player screen, instead it just shows the control bar. The thing I can't understand is when I copy the source of the page, changing the url to an abolute one and save it as an html file, the browser renders it well.
The html file is this:
<!DOCTYPE html>
<html>
<head>
<title>{{ keyword }} - script search</title>
</head>
<body>
<video autoplay width="320" height="240" controls>
<source src="/videos/output.mp4" type="video/mp4" >
</video>
</body>
</html>
And the urls.py is this:
from django.conf.urls.defaults import *
from script_search.search import *
urlpatterns = patterns('',
(r'^$', main_views.main_page),
(r'^videos/(?P<path>.*)$', 'django.views.static.serve', {'document_root': 'C:/Python25/Lib/site-packages/django/bin/script_search/videos'}),
)
What did I do wrong?
I know this is an older question, but I was having this issue for a while, and I solved it, but frankly I'm not even sure why it works. I put the SRC link in the actual Video tags, and not in a source tag. Here, like you, is what I started with:
<video width="320" height="240" controls>
<source src="{{ HighlightVideo }}" type="video/mp4">
</video>
In this instance, HighlightVideo is just passing a string, which is the full URL.
I was getting nothing, and after inspecting a few websites, I realized that they ALSO listed the url in the video tags themselves, like this:
<video width="320" height="240" src="{{ HighlightVideo }}" controls>
</video>
They also used the Source tag, but I did not need it on my website.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.