"use strict";

import React from 'react';
import { TouchableOpacity, StyleSheet } from 'react-native';
import { Video, ResizeMode } from 'expo-av';
import { useDispatch } from 'react-redux';
import { setActiveFile, setActiveModal } from '../../roomStore/chatSettingsSlice';
import { MODAL_TYPES } from '../../helpers/constants/MODAL_TYPES';
import { jsx as _jsx } from "react/jsx-runtime";
const CustomMessageVideo = ({
  fileName,
  fileURL,
  mimetype
}) => {
  const dispatch = useDispatch();
  const handleOpen = () => {
    dispatch(setActiveFile({
      fileName,
      fileURL,
      mimetype
    }));
    dispatch(setActiveModal(MODAL_TYPES.FILE_PREVIEW));
  };
  return /*#__PURE__*/_jsx(TouchableOpacity, {
    style: styles.container,
    onPress: handleOpen,
    children: /*#__PURE__*/_jsx(Video, {
      source: {
        uri: fileURL
      },
      style: styles.video,
      useNativeControls: true,
      resizeMode: ResizeMode.CONTAIN,
      shouldPlay: false
    })
  });
};
export default CustomMessageVideo;
const styles = StyleSheet.create({
  container: {
    margin: 0,
    alignItems: 'center',
    justifyContent: 'center',
    width: '100%'
  },
  video: {
    width: 300,
    height: 200,
    borderRadius: 10,
    backgroundColor: '#000'
  }
});
//# sourceMappingURL=VideoMessage.js.map