Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable <iframe> onclick pause

I want to remove all controls from the user. I used: controls=0 to hide the controls and disablekb=1 to remove the keyboard shortcuts. The last left is the mouse click. I did some research, I didn't find the needed answer.

tl;dr How do I remove the mouse pause form an such as this:

<iframe id="ytplayer" type="text/html" width="640" height="390"
  src='http://www.youtube.com/embed/EgBWDPXF2gU?autoplay=1&disablekb=1&controls=0&origin=http://example.com' ></iframe>

EDIT: There is a legal solution. It doesn't work on 100%, but it will be good enough for most cases. The solution is to simply add an event listener which is looking for the "video is paused event" When this event is triggered, simply start playing the current video. That will work flawlessly and unless the user clicks as fast as around 150-180 clicks per minute the difference for the millisecond when the video was paused before the function ran will be unnoticeable.

I will mark the only submitted answer as the solution simply because if anyone finds this he should, at first, know that any further modifications are illegal.

like image 883
Stanimirovv Avatar asked Dec 25 '22 23:12

Stanimirovv


2 Answers

Try this trick for iframe or iframe wrapper:

#ytplayer {pointer-events: none;}
like image 118
350D Avatar answered Jan 12 '23 04:01

350D


Sorry to say but that is not a legal action. You could be banned for that from youtube. https://developers.google.com/youtube/terms

like image 31
ceasar Avatar answered Jan 12 '23 04:01

ceasar