I want to show video from folder(which is other than project folder). I did it using servlet as follows
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Video extends HttpServlet {
public void doGet(HttpServletRequest request,HttpServletResponse response)
throws IOException
{
response.setContentType("video/mp4");
ServletOutputStream out;
out = response.getOutputStream();
FileInputStream fin = new FileInputStream("D:/7-4/Html/myvideo");
BufferedInputStream bin = new BufferedInputStream(fin);
BufferedOutputStream bout = new BufferedOutputStream(out);
int ch =0;
while((ch=bin.read())!=-1)
{
bout.write(ch);
}
bin.close();
fin.close();
bout.close();
out.close();
}
}
But when i run the project that webpage cannot run using browser's video plugin(it can run mp4 video). But when i tried to save it(using cntr+s) it got saved correctly please tell me proper way to achieve this. I know it is working to show images and pdfs but when it come to video the browser cannot run the video that's why i asked this question