title: Show image or video depending on Content-Type in React-Native
body: <p>I would like to show to the user, in my react-native app, an element reachable on a specific url such as: <code>https://s3-eu-west-1.amazonaws.com/somebucket/somekey</code></p>
  
  <p>This object has a Content-Type that can be <code>image/jpeg</code> or <code>video/mp4</code>.</p>
  
  <p>If it is an image, it has to be printed in an <code>&lt;Image&gt;</code> component from <a href="https://facebook.github.io/react-native/docs/image.html" rel="nofollow noreferrer">https://facebook.github.io/react-native/docs/image.html</a>.</p>
  
  <p>If it is a video, it has to be shown in a <code>&lt;Video&gt;</code> component from <a href="https://github.com/react-native-community/react-native-video" rel="nofollow noreferrer">https://github.com/react-native-community/react-native-video</a></p>
  
  <p>What is a clean way to show this media without downloading it in a first place (the video can be seen as a stream in <code>&lt;Video&gt;</code>) and without knowing its <code>Content-Type</code>?</p>
  
  <p>Right, the solution that I have found is to do a <code>HEAD</code> request on the media to get the <code>Content-Type</code> and then accessing it from the proper React component. Would you have a better solution to avoid this <code>HEAD</code> request? </p>