Joe T. Boka
Joe T. Boka

Reputation: 6581

How is Facebook able to autoplay videos on mobile browsers

I realize that many questions have been asked about autoplay videos on mobile devices but before my question is marked as a duplicate, I must say that I looked through a lot of those questions and answers and I have not found a satisfactory answer.

Mostly, all of the answers say that it's not possible to autoplay videos on mobile browsers.

My question: How can Facebook autoplay videos on mobile browsers?

Upvotes: 0

Views: 619

Answers (1)

Irfan
Irfan

Reputation: 156

Videos can only be started by user interaction. This is usually clicking a button but you can also use any of the touch events (https://developer.mozilla.org/en-US/docs/Web/API/Touch_events).

To replicate the functionality, you can use touchmove to detect the user scrolling through the page and use it to trigger a play when the video is visible.

Upvotes: 1

Related Questions