mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-26 00:31:20 -08:00
4.1.4
This commit is contained in:
1 parent
d6ea0b2355
commit
072ba6e703
8 files changed
+27
-20
No files matched your search
@@ -1,7 +1,11 @@
|
||||
import { setStyle, hasClass, addClass, removeClass, def } from '../utils';
|
||||
|
||||
export default function autoHeightMix(art, player) {
|
||||
const { $container, $video } = art.template;
|
||||
const {
|
||||
option,
|
||||
template: { $container, $video },
|
||||
} = art;
|
||||
|
||||
const heightCache = $container.style.height;
|
||||
|
||||
def(player, 'autoHeight', {
|
||||
@@ -13,14 +17,14 @@ export default function autoHeightMix(art, player) {
|
||||
const { clientWidth } = $container;
|
||||
const { videoHeight, videoWidth } = $video;
|
||||
const height = videoHeight * (clientWidth / videoWidth);
|
||||
if (height) {
|
||||
setStyle($container, 'height', height + 'px');
|
||||
addClass($container, 'art-auto-height');
|
||||
art.emit('autoHeight', height);
|
||||
}
|
||||
setStyle($container, 'height', height + 'px');
|
||||
addClass($container, 'art-auto-height');
|
||||
player.autoSize = option.autoSize;
|
||||
art.emit('autoHeight', height);
|
||||
} else {
|
||||
setStyle($container, 'height', heightCache);
|
||||
removeClass($container, 'art-auto-height');
|
||||
player.autoSize = option.autoSize;
|
||||
art.emit('autoHeight');
|
||||
}
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user