Jump to content

Dhanapal

Members
  • Posts

    1
  • Joined

  • Last visited

About Dhanapal

  • Birthday 07/30/1983

Dhanapal's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. The following code works for IE , FireFox , Chorme and Safari(mac machine) but not working in iPad Safari. <video src=' http://10.63.1.51:80...name(video1.mp4)' style='width: 100%;height: 100%;' /> OR <embed src=' http://10.63.1.51:80...app/video?file=serverpath+filename(video1.mp4)' style='width: 100%;height: 100%;volume: x-loud;' volume='100%' /> in Jsp page. Java Code as, BufferedOutputStream output =null; BufferedInputStream input = null; File file= null; try { String Dir_File=request.getParameter("file"); file = new File(Dir_File); if(imageFile!=null && imageFile.indexOf(".wmv")!=-1) { response.setContentType("video/x-ms-wmv"); } else if(imageFile!=null && imageFile.indexOf(".mp4")!=-1) { response.setContentType("video/mp4"); } else if(imageFile!=null && imageFile.indexOf(".webm")!=-1) { response.setContentType("video/webm"); } else if(imageFile!=null && imageFile.indexOf(".ogg")!=-1) { response.setContentType("video/ogg"); } else { System.out.println("Video file format not correct"); } //response.setHeader("Content-Type", "video/quicktime"); response.setHeader("Content-Length", String.valueOf(file.length())); response.setHeader("Content-Disposition", "inline; filename=\"" + file.getName() + "\""); input = new BufferedInputStream(new FileInputStream(file)); output = new BufferedOutputStream(response.getOutputStream()); byte[] buffer = new byte[10240]; for (int length = 0; (length = input.read(buffer)) > 0;) { output.write(buffer, 0, length); } } finally { if (output != null) try { output.close(); } catch (IOException logOrIgnore) {} if (input != null) try { input.close(); } catch(Exception e) { } }
×
×
  • Create New...