���� JFIF �� � ( %"1"%)+...383,7(-.-
![]() Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20 System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 User : apache ( 48) PHP Version : 7.4.20 Disable Function : NONE Directory : /var/www/html/video/layout/js/node_modules/artplayer/src/player/ |
import { setStyle, def } from '../utils'; export default function aspectRatioMix(art) { const { i18n, notice, template: { $video, $player }, } = art; def(art, 'aspectRatio', { get() { return $player.dataset.aspectRatio || 'default'; }, set(ratio) { if (!ratio) ratio = 'default'; if (ratio === 'default') { setStyle($video, 'width', null); setStyle($video, 'height', null); setStyle($video, 'margin', null); delete $player.dataset.aspectRatio; } else { const ratioArray = ratio.split(':').map(Number); const { clientWidth, clientHeight } = $player; const playerRatio = clientWidth / clientHeight; const setupRatio = ratioArray[0] / ratioArray[1]; if (playerRatio > setupRatio) { setStyle($video, 'width', `${setupRatio * clientHeight}px`); setStyle($video, 'height', '100%'); setStyle($video, 'margin', '0 auto'); } else { setStyle($video, 'width', '100%'); setStyle($video, 'height', `${clientWidth / setupRatio}px`); setStyle($video, 'margin', 'auto 0'); } $player.dataset.aspectRatio = ratio; } notice.show = `${i18n.get('Aspect Ratio')}: ${ratio === 'default' ? i18n.get('Default') : ratio}`; art.emit('aspectRatio', ratio); }, }); }