0

django 3.2.8; safari Version 14.0.3 (16610.4.3.1.7)

for mp4 and mov, safari does not work, chrome and opera does.

relative useful posts

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.

Weilory
  • 2,621
  • 19
  • 35
  • Your main goal is to make video player working on local machine or prepare it for production? – Yevgeniy Kosmak Dec 24 '21 at 14:43
  • @YevgeniyKosmak sorry a bit confusion here, isn't making the player working on my local machine the first step to prepare it for production? I cannot get it working on my machine now, in safari and chrome. – Weilory Dec 25 '21 at 07:55
  • @Weilory Can you replace `{{ video.file.url }}` with some `https://` video URL and test if it's problem with your local videofile? – Yevhen Bondar Dec 26 '21 at 18:32

0 Answers0