Abhishek Shrma

Greenhorn
+ Follow
since Mar 22, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Abhishek Shrma

String videoUrl = "../videos/"+"abhishek"+"/"+"videos"+"/"+batchName+"/"+videoName+"/200";
HTML video = new HTML("<video id=\"my_video_1\" class=\"video-js vjs-default-skin\" controls preload=\"auto\" width=\"640\" height=\"264\" data-setup=\"{}\">"+
"<source src="+videoUrl+" type='video/mp4'></video>");


here videos is my servlet


String videoPath= "C:/mnt/bigvol/WebImages/videos/2011/clips/";
String videoName= "L_00010.mp4";
ServletContext application= getServletConfig().getServletContext();
File file = new File(videoPath,videoName);


String contentType = getServletContext().getMimeType(file.getName());
response.setBufferSize(DEFAULT_BUFFER_SIZE);
response.setHeader("Content-Type", "video/mp4");
response.setHeader("Content-Length", Long.toString(file.length()));
response.setHeader("Content-Disposition", "inline; filename=\"" + file.getName() + "\"");

// Prepare streams.
BufferedInputStream input = null;
ServletOutputStream outputStream = response.getOutputStream();
BufferedOutputStream output = null;
try {
// Open streams.
byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
input = new BufferedInputStream(new FileInputStream(file), DEFAULT_BUFFER_SIZE);
output = new BufferedOutputStream(response.getOutputStream(), DEFAULT_BUFFER_SIZE);

// Write file contents to response.

int length;
while ((length = input.read(buffer,0,4096)) != -1) {
outputStream.write(buffer, 0, length);
}
} finally {
// Gently close streams.
// close(output);
// close(input);
try{
if(input != null)
input.close();
}catch (Exception e) {
// TODO: handle exception
}
if(outputStream != null)
outputStream.flush();
}

I cannot seek forward or backward and once played I cant play again .
I can setup a new server to serve video I read something like HTTP pusedstreaming etc.

Is I am in right direction ??
12 years ago
Hello Paul,

May be I didn't clear my requirements properly . Here what I want.

I have like TB's of video stored in mnt drive.
Each video has it name stored in DB. So my video list page shows all videos link like <a href="video.abhishek.com?id=<id>&encrypt=<key>>${video.VideoName}</a>
Now when I'll click any link it will go to Servlet which will pull video from mnt drive and and dispatch to a jsp page so that I can use this

<video><source src="video.abhishek.com/samplevideo.mp4"></video>

I can able to do this if my video is stored on web directory but as I mentioned all my videos are in a separate drive

I dont' know if I want youtube of any thing, but wat I mentioned is my requirement.

Please Help
12 years ago
Hello Rob,

Thank you for your reply. I did that already. May be I didn't explained my question properly.
What you said will work but only once, I mean you won't have to seek video, because it's depend on outputstream.

Do I need any video server or something, for example

I have
<video><source src="http://video.abhishek.com?id=1&encrypt=........"></source></video>

so this will hit my server and grab video to play. All videos are stored in mnt drive (not in same webserver).

Please guide me thanks
12 years ago
I want to create my own site like youtube.

I have so many videos stored in exteranl HDD.

I don't how to start or what to do.

In HTML%, there is a video and we can provide source ="" ...

I want my servlet to read video file from storage location... so I can use tht url as src for video tag

Please show me direction what to do


Thanks
Abhi
12 years ago