V
V
vk222019-11-08 12:51:18
iPhone
vk22, 2019-11-08 12:51:18

How to play video on iphone (safari)?

Good people! Help to cope with playing video on iPhone in its native player.
What's up:
I have a vue app with video galleries. Slides are spinning, click on one, get the file from the server, open it in the player in the popup. I took the player plyr.io. Everything is ok on desktop. But ios needs the video to open in the fullscreen native player of the iPhone. The problem is that on IOS Safari I can’t manage my own permissions with which I can’t handle it yet. When I run video.play() I get an error:
"Unhandled Promise Rejection: NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission."
Now I do it through createElement and then change its src:

videoInit() {
      this.video = document.createElement("video");
      this.video.setAttribute("src", this.slidesSrc[0]);
      this.video.autoplay = true;
      this.video.muted = true;
      this.video.preload = 'auto';
  },
videoPlay(index) {
    this.video.setAttribute("src", this.slidesSrc[index]);
    this.video.muted = false;
    this.video.play();
}

In this case, it somehow began to work, but it still gives the error "Unhandled Promise Rejection: NotAllowedError: ..." Every other time, tell me
, how to make playback on IOS correctly?
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question