This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

video playing/streaming

 
Singh Kuldeep
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65225
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ShowSomeEffort. What have you tried so far? What problems are you having?
 
Singh Kuldeep
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65225
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Impossible. To play the video, the data must be sent to the client.
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Singh Kuldeep
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65225
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You still haven't shown us the code.
 
Singh Kuldeep
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65225
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic