mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-10 21:06:15 -08:00
update iframe demo
This commit is contained in:
1 parent
8b8d58dd66
commit
2d48f247ad
4 files changed
+245
-233
No files matched your search
+16
-4
@@ -43,17 +43,29 @@
|
||||
});
|
||||
|
||||
art.on('fullscreenWeb', state => {
|
||||
// 向父窗口发送信息
|
||||
window.parent.postMessage({
|
||||
from: 'child',
|
||||
type: 'fullscreenWeb',
|
||||
data: state,
|
||||
}, '*');
|
||||
});
|
||||
|
||||
// 接收父窗口的信息
|
||||
window.addEventListener('message', (event) => {
|
||||
console.log('来自父窗口的信息 -->', event.data);
|
||||
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>
|
||||
|
||||
Reference in new issue
Block a user