"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _reactNative = require("react-native");
var _expoAv = require("expo-av");
var _reactRedux = require("react-redux");
var _chatSettingsSlice = require("../../roomStore/chatSettingsSlice");
var _MODAL_TYPES = require("../../helpers/constants/MODAL_TYPES");
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const CustomMessageVideo = ({
  fileName,
  fileURL,
  mimetype
}) => {
  const dispatch = (0, _reactRedux.useDispatch)();
  const handleOpen = () => {
    dispatch((0, _chatSettingsSlice.setActiveFile)({
      fileName,
      fileURL,
      mimetype
    }));
    dispatch((0, _chatSettingsSlice.setActiveModal)(_MODAL_TYPES.MODAL_TYPES.FILE_PREVIEW));
  };
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
    style: styles.container,
    onPress: handleOpen,
    children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_expoAv.Video, {
      source: {
        uri: fileURL
      },
      style: styles.video,
      useNativeControls: true,
      resizeMode: _expoAv.ResizeMode.CONTAIN,
      shouldPlay: false
    })
  });
};
var _default = exports.default = CustomMessageVideo;
const styles = _reactNative.StyleSheet.create({
  container: {
    margin: 0,
    alignItems: 'center',
    justifyContent: 'center',
    width: '100%'
  },
  video: {
    width: 300,
    height: 200,
    borderRadius: 10,
    backgroundColor: '#000'
  }
});
//# sourceMappingURL=VideoMessage.js.map