php - Autoplay youtube video in iframe on mobile devices

849

I am using iframe to play videos :-

<iframe  width="700" height="395" src="+video_embed_url+?rel=0&autoplay=1" frameborder="0"></iframe>

But not able to autoplay on mobile devices as autoplay won't work on mobile . But if i want how can do it??

987

Answer

Solution:

Did you addautoplay parameter in the iframe's url ?

Such as : http://www.youtube.com/embed/xxxx?autoplay=1

592

Answer

Solution:

Autoplay and Scripted Playback

The HTML5 element, in certain mobile browsers (such as Chrome and Safari), only allows playback to take place if it's initiated by a user interaction (such as tapping on the player). Here's an excerpt from Apple's documentation:

"Warning: To prevent unsolicited downloads over cellular networks at the user’s expense, embedded media cannot be played automatically in Safari on iOS — the user always initiates playback."

Due to this restriction, functions and parameters such as autoplay, playVideo(), loadVideoById() won't work in all mobile environments.

People are also looking for solutions to the problem: PHP MySQL WHERE column-value is in $_POST

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.