-
Notifications
You must be signed in to change notification settings - Fork 4
/
fullscreen-orientation-controls.html
70 lines (70 loc) · 2.17 KB
/
fullscreen-orientation-controls.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!DOCTYPE html>
<html>
<head>
<title>Go fullscreen when in landscape</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet">
<style>
@font-face {
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
src: url(https://example.com/MaterialIcons-Regular.eot); /* For IE6-8 */
src: local('Material Icons'),
local('MaterialIcons-Regular'),
url(https://example.com/MaterialIcons-Regular.woff2) format('woff2'),
url(https://example.com/MaterialIcons-Regular.woff) format('woff'),
url(https://example.com/MaterialIcons-Regular.ttf) format('truetype');
}
.material-icons {
font-family: 'Material Icons';
font-weight: normal;
font-style: normal;
font-size: 24px; /* Preferred icon size */
display: inline-block;
line-height: 1;
text-transform: none;
letter-spacing: normal;
word-wrap: normal;
white-space: nowrap;
direction: ltr;
/* Support for all WebKit browsers. */
-webkit-font-smoothing: antialiased;
/* Support for Safari and Chrome. */
text-rendering: optimizeLegibility;
/* Support for Firefox. */
-moz-osx-font-smoothing: grayscale;
/* Support for IE. */
font-feature-settings: 'liga';
}
#controls {
position: absolute;
background-color: black;
padding: 2px;
z-index: 1;
}
</style>
</head>
<body style='margin:0;'>
<video src='https://storage.googleapis.com/dalecurtis-shared/buck2.mp4' style='width:100%; height:100%;' controls></video>
<script>
var video = document.querySelector('video');
window.screen.orientation.onchange = function() {
if (this.type.startsWith('landscape')) {
if (document.webkitFullscreenElement != video)
video.webkitRequestFullscreen();
} else {
document.webkitExitFullscreen();
}
};
document.onwebkitfullscreenchange = function() {
if (document.webkitFullscreenElement != video) {
window.screen.orientation.unlock();
} else {
window.screen.orientation.lock('landscape');
}
};
</script>
</body>
</html>