0

I try to play videos in my angular app and it plays in chrome browser on any device, but it is not working in safari browser in iPhone 6s with software version 12.3. Strangely it is working on iPhone 7 with software version 14.4. To find the problem I tried to play videos from other websites on my iPhone 6s device and they played without any problem. now I don't know where the problem is? I tried many suggested solutions but it still doesn't work...

it is my html code in angular app:

  <video
    controls
    [src]="mediaDetail?.video"
    [poster]="mediaDetail?.cover"
    class="single_video"
    autoplay loop muted playsinline
    controlsList="nodownload">
  </video>

and it is video result on safari:enter image description here

these are response headers in video request that not working in my angular app but in another website with the same headers, videos working enter image description here

Please suggest any problems that may exist.

usalin
  • 141
  • 1
  • 7
AmiReza
  • 39
  • 1
  • 7
  • It may have to do with the format of the video your are using ! (For example Safari browser can't handle OGG videos) Can you give more details on the file you are trying to play ? – Misfits09 Jun 12 '21 at 09:33
  • @Misfits09 thank you, but my videos format are .mp4 – AmiReza Jun 12 '21 at 09:36
  • You may try with another file, if it still does not work it may have to do with how you serve your static video file. I found this post saying your web server needs to support `Range` header in order for safari to allow this video file to play : https://stackoverflow.com/a/36299252/2131150 Your best option is to serve the file directly with NGINX for example – Misfits09 Jun 12 '21 at 09:40
  • @Misfits09 I added an image from headers – AmiReza Jun 12 '21 at 09:56
  • From Apple's website mentioned in the previous post, to get that possibility out of the way you should use a terminal (with curl package) and run the following command : `curl --range 0-99 -o /dev/null` and if the download is successful the issue is somewhere else, otherwise that must be it ! – Misfits09 Jun 12 '21 at 10:04

1 Answers1

0

I changed the "https" to "http" and I dont know what exactly happened but videos plays over the http protocol

so:

over the https protocol: videos plays on iPhone 7 but not plays on my iPhone 6s device

over the http protocol: videos only plays on my iPhone 7 device

its maybe Safari dont support play video on old device over the https protocol

AmiReza
  • 39
  • 1
  • 7