I am currently implementing a django project to help me with my studies. I would like to be able to monitor videos I watched (ie when? where I stopped if I did not watch it in full? how many times I watched it? ...). I don't plan to upload the videos to the database as it is several Gb of size, but to call with their path on my hard drive.
Basically the features I'm looking for are similar to the ones present in Kodi for those of you which know it.
I Googled for that question and could for instance found the following: How to check a user watched the full video in html5 video player
But the solutions suggested make use of Javascript which I am not very familiar with. Would there be a django/python way to get the event and then just save it to the database with the videos?
[EDIT: 25/09/2018 - Attempt to use Javascript]
Should I want to go with a Javascript/Django solution, may I ask for guidance on how to proceed?
I created a foo.html file in my django project as per the below:
[foo.html]
<video id="video1" width="240" height="200" controls="true" poster="">
<source type="video/mp4" src="{% static 'my/path/my_video.mp4' %}"></source>
</video>
<script>
document.getElementById('video1').addEventListener('ended', function(e) {
// TO COMPLETE
});
</script>
But then, I'd like to put something like
video = Video(name=name, is_watched=True, end_time=now()) # The Video class being defined in models.py as per Django paradigm.
video.save()
instead of the // TO COMPLETE, but I suspect only javascript can be used at this place. Is that correct? If so, would you know how I can close the gap between javascript and django so as to be able to update my database?
Thanks, Sophie