| Author |
video playing/streaming
|
Singh Kuldeep
Greenhorn
Joined: Jul 18, 2012
Posts: 15
|
|
Hi, I want to add video playing support from database to my website using jsp. Can some body help me?
Thank You.....
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56191
|
|
|
ShowSomeEffort. What have you tried so far? What problems are you having?
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Singh Kuldeep
Greenhorn
Joined: Jul 18, 2012
Posts: 15
|
|
Bear Bibeault wrote:ShowSomeEffort. What have you tried so far? What problems are you having?
Hi Bibeaul! thanks for your reply.
Actually I upload a video on server and kept the reference in database by name. Now i want to play this video on client(browser ) with out downloading.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56191
|
|
|
Impossible. To play the video, the data must be sent to the client.
|
 |
Jaikiran Pai
Marshal
Joined: Jul 20, 2005
Posts: 8143
|
|
Singh Kuldeep wrote:
Actually I upload a video on server and kept the reference in database by name. Now i want to play this video on client(browser ) with out downloading.
You have to explain what exactly you mean by "without downloading"? Do you mean, when the video is requested by the client, you don't want a "save as" window to pop-up and instead it should just start playing in the client browser?
|
[My Blog] [JavaRanch Journal]
|
 |
Singh Kuldeep
Greenhorn
Joined: Jul 18, 2012
Posts: 15
|
|
Jaikiran Pai wrote:
Singh Kuldeep wrote:
Actually I upload a video on server and kept the reference in database by name. Now i want to play this video on client(browser ) with out downloading.
You have to explain what exactly you mean by "without downloading"? Do you mean, when the video is requested by the client, you don't want a "save as" window to pop-up and instead it should just start playing in the client browser?
yes.... exactly. I don't want client to save as option. it should start playing in browser....
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56191
|
|
|
You still haven't shown us the code.
|
 |
Singh Kuldeep
Greenhorn
Joined: Jul 18, 2012
Posts: 15
|
|
Bear Bibeault wrote:You still haven't shown us the code.
<%
String filename = "C:\\uploaded-download\\anjane.mov"; //my own filename
//you can write http://localhost
//String filepath = "C:/"; //located on Local C harddisk
BufferedInputStream buf = null;
try {
File myfile = new File( filename);
//set response headers
response.setContentType("application"); //I want to play a video file
response.addHeader(
"Content-Disposition", "attachment; filename=" + filename);
response.setContentLength((int) myfile.length());
FileInputStream input = new FileInputStream(myfile);
buf = new BufferedInputStream(input);
int readBytes = 0;
//read from the file; write to the ServletOutputStream
while ((readBytes = buf.read()) != -1) {
out.write(readBytes);
}
} catch (IOException ioe) {
} finally {
}
%>
Hi Bear Bibeault, Please check this.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56191
|
|
You're trying to stream it from a JSP?
Step 1: Move the code out of a JSP and into a servlet. JSP is a completely unsuitable technology for this.
|
 |
 |
|
|
subject: video playing/streaming
|
|
|