Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Youtube iframe - 'fullscreen is unavailable'

I am using iframe to play youtube video. It display full screen icon but on click it says 'fullscreen is unavailable'. I am using allfullscreen still it is not working. Below is the code I have tried so far.

Code 1.

<iframe width="760" height="415" id={showVid.id} title={showVid.title} src={showVid.link} allowfullscreen allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"></iframe>

Code 2.

<iframe width="760" height="415" id={showVid.id} title={showVid.title} src={showVid.link} allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture fullscreen"></iframe>
like image 494
nothing Avatar asked Dec 05 '25 14:12

nothing


2 Answers

Depending on which browser you are using you may need alternative settings turned on iframe see: YouTube iframe embed - full screen for in depth answer

like image 80
HugoDos Avatar answered Dec 08 '25 06:12

HugoDos


Make sure you are using https in the src attribute for youtube, e.g.

<iframe allow="fullscreen;" src="https://www.youtube.com/embed/{video.id}"></iframe>

I was developing locally using a "//www.youtube.com" link and fullscreen would never work for me!

like image 21
Alan Mitchell Avatar answered Dec 08 '25 05:12

Alan Mitchell



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!