Dhanapal Posted June 4, 2012 Share Posted June 4, 2012 (edited) 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) { } } Edited June 13, 2012 by Dhanapal Link to comment Share on other sites More sharing options...
Ingolme Posted June 4, 2012 Share Posted June 4, 2012 The <video> element is part of the HTML 5 standard which hasn't been fully adopted by all browsers yet. I'm not surprised if mobile browsers don't support embedded content. The <embed> and <object> tags require the device to have some sort of plug-in available for the browser. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now