django 3.2.8; safari Version 14.0.3 (16610.4.3.1.7)
for
mp4
andmov
, safari does not work, chrome and opera does.
relative useful posts
- https://stackoverflow.com/a/7913160/11645617
- https://wpmudev.com/forums/topic/mp4-videos-not-loading-on-safari/
- Failed to Load Resource, Plugin Handled Load on iOS
Hi there, I am trying to build a simple video app with django on my local machine.
class Video(models.Model):
author = models.ForeignKey(User, on_delete=models.CASCADE)
thumbnail = models.ImageField(upload_to='thumbnail', blank=True, null=True)
file = models.FileField(upload_to='video', validators=[FileExtensionValidator(allowed_extensions=['mov', 'MOV','avi','mp4', 'MP4','webm','mkv'])])
list view
{% for video in page_obj.object_list %}
<video width="400"
height="350"
controls
{% if video.thumbnail %}
poster="{{ video.thumbnail.url }}"
{% endif %}
>
<source src=
"{{ video.file.url }}"
type="video/mov">
</video>
{% endfor %}
Video is not playing on Safari.
Failed to load resource: Plug-in handled load
in terminal
[20/Dec/2021 03:14:16,147] - Broken pipe from ('127.0.0.1', 50812)
I wonder why this happens, will be grateful for your help.
what I have tried
add
raw="true"
to video tag
did not work, still the same result
transcoding video to web optimised by handbrake
some videos that did not work on Chrome and Opera started to work
But, not for Safari
tries to embed an YouTube iframe
always works on safari
I suspect the issue is on file server
, which I served the video as a file. Safari and chrome requires the video to be served as blob
, I wonder if there is a way to do it, appreciate for your help.