import { ASPECT_RATIO_SEPARATOR } from '../constants/aspectRatios';

const getAspectRatio = (aspectRatioString = '') => {
    if (!aspectRatioString) {
        return null;
    }

    return aspectRatioString.split(ASPECT_RATIO_SEPARATOR);
};

export const getVideoPaddingTop = (aspectRatioString = '') => {
    const aspectRatio = aspectRatioString ? getAspectRatio(aspectRatioString) : null;

    if (aspectRatio && aspectRatio[0] && aspectRatio[1]) {
        return aspectRatio[1] / aspectRatio[0] * 100;
    }

    return 0;
};
