C
C
cajka-d2021-04-25 10:24:44
JavaScript
cajka-d, 2021-04-25 10:24:44

Why doesn't video work in safari?

Hello.
I use the tag to embed a video on a page. To start and stop the video, I use my own button, on which I hung a click event. jQuery code.

The code:

<video controls="" id="project_video">
<source src="http://revolution/wp-content/uploads/2021/04/00021.mp4" type="video/mp4">
</video>


$('.project').on('click', '.button-video', function(){
    var video_id = $(this).data('video_id'),
      button_id = $(this).attr('id'),
      obj_video = $('#' + video_id)[0];

    if (obj_video.paused && button_id != 'button_pause'){
      obj_video.play() 
    } else {
      obj_video.pause();
    }

    return false;
  });


Works in all browsers except safari. What can be wrong? Version safari 13. It was checked in other browsers, it works in all. Here is the page itself with the video sh1313475.a.had.su/project/otdelka-fasada-restorana Section on the left "Video". Just do not immediately go to the video, because there is a section loading, and the loading animation has not yet been added.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
MiyRon, 2021-04-25
@MiyRon

JavaScript is blocked in safari, some functions do not work. Or try enabling JavaScript in your safari. I don't know what specific version of safari you are using, but you should look at how js works in safari.

V
Vladimir Korotenko, 2021-04-25
@firedragon

I would open the developer panel, there will be some errors and I would change the code based on them

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question