Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Kholja

Draggable to start video not working in Safari

Go to solution Solved by iDad5,

Recommended Posts

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

Link to comment
Share on other sites

  • Solution

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
Link to comment
Share on other sites

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 :-)

Link to comment
Share on other sites

You're welcome, glad I could help. 

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

×