export enum VideoPlayerType {
  m3u8 = 'application/x-mpegURL',
  mp4 = 'video/mp4',
  webm = 'video/webm',
}

export const getVideoTypeByUrl = (url: string) => {
  const splitExtReg = /(?:.*)(?<=\.)/;

  const type = url.replace(splitExtReg, '');

  if (VideoPlayerType[type]) return VideoPlayerType[type];

  return VideoPlayerType.mp4;
};
