Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

opening a video file in a browser

Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a problem opening a video file in a browser through an application.

Techhologies used are servlets and templates

Here is the flow for ur understanding.

I have a link in a template clicking on which calls a javascript(openWindow)taking the url as parameter)Before opening the file the following process takes place.

Reads the file from the database and stores it in a filestore(some folder in server)

//Write the file from BLOB (taking the file data from database)

and then stores it in filestore by taking fileID and filepath.fileIdentifier is the filename.

File oFile = new File(filePath + "/" + fileIdentifier);
out = new BufferedOutputStream(new FileOutputStream(oFile),

//create byte buffer and start reading the file
byte[] b = new byte[bufferSize];
int count =, 0, bufferSize);
logger.debug("Writing file now");

while (count != -1) {
out.write(b, 0, count);
count =, 0, (int) bufferSize);
} // end count!=-1

out = null;
in = null;

After all this process it opens a new window displaying the content of the file

This is all working fine for text files, docs and images but is not the case for opening an audio and video file. For video file ,it opens a new window displaying junk text.

Here is the javascript called on clicking the link in the template.

function openFileinWindow(url, width, menubar){
// has not yet been defined,'new1','menubar=' + menubar + ',toolbar=yes,scrollbars=yes,width=' + width + ',height=450');
//has been defined
// still open
},'new1','menubar=' + menubar + ',toolbar=yes,scrollbars=yes,width=' + width + ',height=450');

Could you please help me out in this topic?

Thank you
Ranch Hand
Posts: 233
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not sure, but worth checking.
From command prompt type the "assoc". This command is intended to Displays or modifies file extension associations.
Look for the your audio and video file associations. If not present use the same to associate to audio or video players. same command can be use to associate. Use command "help assoc" to get more details about the assoc command.

author and iconoclast
Posts: 24204
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Arun is talking about desktop configuration, which certainly matters, but unless your client machine has never been used to view video at all (seems unlikely) I doubt that is the problem. The first thing that occurs to me is that that you haven't shown us any code which sets the content-type for the download -- are you sure you're setting it correctly?
God is a comedian playing for an audience that is afraid to laugh - Voltair. tiny ad:
Garden Master Course kickstarter
    Bookmark Topic Watch Topic
  • New Topic