Jump to content

Problem with automatic video start 1.7.6.7 (SOLVED)


LuanaBorgia

Recommended Posts

If you want to the video start when open browser, you need to add the param in the iframe:

<iframe width="560" height="315" src="https://www.youtube.com/embed/MrOAmysdycA?autoplay=1" frameborder="0" allow="autoplay"></iframe>

And it only auto start on chrome, Edge (not work on firefox).

If you add the param

<iframe width="560" height="315" src="https://www.youtube.com/embed/MrOAmysdycA?autoplay=1&mute=1" frameborder="0" allow="autoplay"></iframe>

The video start on the firefox (but muted).

You can read more it in here:

https://stackoverflow.com/questions/7281765/how-to-embed-an-autoplaying-youtube-video-in-an-iframe

 

  • Like 1
Link to comment
Share on other sites

Yeahhh it's perfect! 😍
Thanks, but only the last question, for a normal mp4 video (not Youtube), to start on opening what's the right command?
I have try <video controls autoplay><source src="movie.mp4" type="video/mp4"></video> but not start (only first frame in pause)

Thanks

Link to comment
Share on other sites

Ok, after many errors i find the solution.
The video must be MUTED!
I use this code:

<video width="100%" height="auto" muted="" autoplay="autoplay" controls="controls" controlslist="nodownload"><source src="video.mp4" type="video/mp4" /></video>

I hope that this code can help someone.

Bye Bye

Link to comment
Share on other sites

  • 10 months later...

You cannot display a lot of websites inside an iFrame. Reason being that they send an "X-Frame-Options: SAMEORIGIN" response header. This option prevents the browser from displaying iFrames that are not hosted on the same domain as the parent page.

I faced the same error when displaying YouTube links. For example:

https://www.youtube.com/watch?v=8WkuChVeL0s

I replaced watch?v= with embed/ so the valid link will be:

https://www.youtube.com/embed/8WkuChVeL0s

It works well. (Reason : /embed has the required header)

Try to apply the same rule on your case.

Why is X-Frame-Options

It is there for user security. Prevents clickjacking :

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options

The embed endpoint is desinged to be safer to show on external websites (not youtube.com).

SAMEORIGIN

The page can only be displayed in a frame on the same origin as the page itself. The spec leaves it up to browser vendors to decide whether this option applies to the top level, the parent, or the whole chain, although it is argued that the option is not very useful unless all ancestors are also in the same origin.

 

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
×
×
  • Create New...