mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-08 19:06:15 -08:00
72 lines
2.0 KiB
HTML
72 lines
2.0 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Artplayer Iframe Fullscreen Web</title>
|
|
<style>
|
|
html,
|
|
body {
|
|
width: 100%;
|
|
height: 100%;
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
|
|
.container {
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
|
|
.artplayer-app {
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<div class="container">
|
|
<div class="artplayer-app"></div>
|
|
</div>
|
|
<script src="../uncompiled/artplayer/index.js"></script>
|
|
<script>
|
|
var art = new Artplayer({
|
|
container: '.artplayer-app',
|
|
url: '../assets/sample/video.mp4',
|
|
fullscreen: true,
|
|
fullscreenWeb: true,
|
|
autoOrientation: true,
|
|
whitelist: ['*'],
|
|
});
|
|
|
|
art.on('fullscreenWeb', state => {
|
|
window.parent.postMessage({
|
|
type: 'fullscreenWeb',
|
|
data: state,
|
|
}, '*');
|
|
});
|
|
|
|
window.addEventListener('message', (event) => {
|
|
const { template: { $player }, plugins: { autoOrientation } } = art;
|
|
const { type, data: { clientHeight, clientWidth } } = event.data;
|
|
switch (type) {
|
|
case 'autoOrientation':
|
|
setTimeout(() => {
|
|
if (autoOrientation?.state) {
|
|
$player.style.width = `${clientHeight}px`;
|
|
$player.style.height = `${clientWidth}px`;
|
|
$player.style.transform = `rotate(90deg) translate(0, -${clientWidth}px)`;
|
|
}
|
|
}, Artplayer.MOBILE_AUTO_ORIENTATION_TIME)
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
|
|
</html> |