0

Looking at this handy page: HTML5 Video Events and API has been extremely useful. However, there's one attribute of an HTML5 video that I want to be able to get or set programmatically, and it's not listed there. So I'm wondering, is it possible?

I want to be able to detect whether the 'full screen' button has been clicked by the user, and potentially I want my code to switch the video into or out of full screen mode automatically.

Can it be done? And if so, how do you do it?

I'm using IE harnessed within a Visual Studio WebBrowser element, if that makes a difference.

Stuart Bruce
  • 111
  • 1
  • 7

1 Answers1

0

You can make the video fullscreen using Full screen api.

var elem = document.getElementById("myvideo");
if (elem.requestFullscreen) {
  elem.requestFullscreen();
} else if (elem.mozRequestFullScreen) {
  elem.mozRequestFullScreen();
} else if (elem.webkitRequestFullscreen) {
  elem.webkitRequestFullscreen();
}

Check this answer: https://stackoverflow.com/a/6039930/3898364

Community
  • 1
  • 1
Arun D
  • 2,369
  • 5
  • 27
  • 39
  • Thanks for this. Unfortunately while these methods work in JavaScript, calling those methods either via RaiseEvent or InvokeMember on a video element in HTML5 embedded in a Visual Studio WebBrowser seems to have no effect. So your answer will suit 99.9% of people, but unfortunately it doesn't solve my particular problem. – Stuart Bruce May 14 '16 at 09:13