Jump to content
Search Community

Draggable to start video not working in Safari

Kholja

Go to solution Solved by iDad5,

Recommended Posts

Posted

Hi Guys,

I want to start a video via a slider, which is built with draggable and inertia. This works in Chrome and Firefox.
Safari interprets the action after onThrowComplete as autoplay and prevents playing the video, due to it's autoplay-policy (except video is muted).

However it seems to be OK for Safari if I start the video with a ordinary button (at the bottom of the example).

Any idea how to solve this?

 

See the Pen wvoOWRQ by kholja (@kholja) on CodePen.

  • Solution
Posted

You could try to start the video on mousedown (when the user starts dragging) and immediately pause it. After that you should be able to play it programmatically ever after ;-)

  • Like 3
Posted
34 minutes ago, iDad5 said:

You could try to start the video on mousedown (when the user starts dragging) and immediately pause it. After that you should be able to play it programmatically ever after ;-)

Thanks @iDad5 this works. Great idea, great forum :-)

Posted

You're welcome, glad I could help. 

Posted

Just 2 cents more, if you don’t want the poster frame to be replaced by the first frame of the actual video - which might happen under certain preloaded conditions, it might also work to start playing a hidden video or even audio. I’m not 100% sure, but my understanding is, that once ans media has started due to user interaction, the rest on that page is fair game for programming. 

  • Like 1
Posted
1 hour ago, iDad5 said:

Just 2 cents more, if you don’t want the poster frame to be replaced by the first frame of the actual video - which might happen under certain preloaded conditions, it might also work to start playing a hidden video or even audio. I’m not 100% sure, but my understanding is, that once ans media has started due to user interaction, the rest on that page is fair game for programming. 

Good hint - thanks for pointing that out.

Posted

To finish this up I did a short test with an audio file. Indeed you can control all other media programmatically after the audio file played due to a click or mousedown event. Controlling the video was possible without any limitations.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...