title: Delay in playing video file from Input Stream
body: <p>I am playing the video file from input stream below is my method:</p>
  
  <pre><code>public static String getDataSource(InputStream inputStream) throws IOException {
              InputStream stream = inputStream;
              if (stream == null)
                  throw new RuntimeException("stream is null");
              File temp = File.createTempFile("mediaplayertmp", "dat");
              temp.deleteOnExit();
              String tempPath = temp.getAbsolutePath();
              FileOutputStream out = new FileOutputStream(temp);
              byte buf[] = new byte[128];
              do {
                  int numread = stream.read(buf);
                  if (numread &lt;= 0)
                      break;
                  out.write(buf, 0, numread);
              } while (true);
              try {
                  stream.close();
                  out.close();
              } catch (IOException ex) {
                //  Log.e(TAG, "error: " + ex.getMessage(), ex);
              }
              return tempPath;
            }
  </code></pre>
  
  <p>But on click of button there is a <code>delay of 3 to 4 seconds</code> to play the video file, why so can any one please help me out?</p>