title: How to send video to server from android,which able to play back in browser when go to the URL assign to it?
body: <p>I send a video file(capture from camera) to my PHP server using Retrofit 2,the video is successfully uploaded to a folder in server(I checked with FileZilla, the video exists in the folder),I assign the video to a URL,I go to the same Url(using browser) it cant play the video.</p>
  
  <p>It just appears like this in Url(example: mydomain.cc/video/VID_2014.mp4)</p>
  
  <p><a href="https://i.stack.imgur.com/NqOwq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NqOwq.png" alt="enter image description here"></a></p>
  
  <p>So I test with a random video, send it via postman, the URL of that video is able to playback.</p>
  
  <p><strong>Like so:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/FbZsE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FbZsE.png" alt="enter image description here"></a></p>
  
  <p>My video file path in Android that I get in <code>onActivityResult</code> after capturing video looks like this </p>
  
  <blockquote>
    <p>/storage/emulated/0/DCIM/ABC/VID_20171008_183129.mp4</p>
  </blockquote>
  
  <p><strong>Here is my code for sending video file</strong></p>
  
  <pre><code> private void uploadVideoToServer(String pathToVideoFile){
      File videoFile = new File(pathToVideoFile);
      RequestBody videoBody = RequestBody.create(MediaType.parse("video/*"), videoFile);
      MultipartBody.Part vFile = MultipartBody.Part.createFormData("video", videoFile.getName(), videoBody);
      Retrofit retrofit = new Retrofit.Builder()
              .baseUrl(SERVER_PATH)
              .addConverterFactory(GsonConverterFactory.create())
              .build();
      VideoInterface vInterface = retrofit.create(VideoInterface.class);
      Call&lt;ResultObject&gt;  serverCom = vInterface.uploadVideoToServer(vFile);
      serverCom.enqueue(new Callback&lt;ResultObject&gt;() {
          @Override
          public void onResponse(Call&lt;ResultObject&gt; call, Response&lt;ResultObject&gt; response) {
              ResultObject result = response.body();
              if(!TextUtils.isEmpty(result.getSuccess())){
                  Toast.makeText(MainActivity.this, "Result " + result.getSuccess(), Toast.LENGTH_LONG).show();
                  Log.d(TAG, "Result " + result.getSuccess());
              }
          }
          @Override
          public void onFailure(Call&lt;ResultObject&gt; call, Throwable t) {
              Log.d(TAG, "Error message " + t.getMessage());
          }
      });
  }
  </code></pre>
  
  <p><strong>VideoInterface.java</strong></p>
  
  <pre><code>public interface VideoInterface {
      @Multipart
      @POST("video.php")
      Call&lt;ResultObject&gt; uploadVideoToServer(@Part MultipartBody.Part video);
  }
  </code></pre>
  
  <p>So my question is, why video capture from the Android camera not able to playback in Url? Does this matter?</p>
  
  <p>Cause I worried later I need to display back to my app by using the Url, if matter how to solve this?</p>
  
  <p>So somebody please give me a complete solution for doing this..</p>
  
  <p>EDIT: 
  I checked the codec by using the ffmpeg, here is the result..</p>
  
  <p><a href="https://i.stack.imgur.com/gIIuH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gIIuH.png" alt="enter image description here"></a> <a href="https://i.stack.imgur.com/ZCuMM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZCuMM.png" alt="enter image description here"></a></p>