import React from 'react';
import { string, func } from 'prop-types';
import WebView from 'react-native-autoheight-webview';

const VimeoPlayer = ({ videoId, onError }) => {
  return (
    <WebView
      style={style}
      onError={onError}
      allowsFullscreenVideo
      scrollEnabled={false}
      height={200}
      source={{
        uri: `https://player.vimeo.com/video/${videoId}?h=489fff465c`,
        headers: {"Referer":"https://social.emmint.com"}
      }}
    />
  );
};

export default VimeoPlayer;

const style = {
  height: 200,
  maxWidth: '100%',
};

VimeoPlayer.propTypes = {
  videoId: string,
  onError: func,
};