File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Embeding a video with a dynamic Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Embeding a video with a dynamic "src"" Watch "Embeding a video with a dynamic "src"" New topic

Embeding a video with a dynamic "src"

Dilshan Edirisuriya
Ranch Hand

Joined: Apr 22, 2006
Posts: 299
I need to embed a video in the jsp page. The "src" of the object tag is dynamic. Here is my coding.

I have several links in a data grid. In the onclick event of those links I am calling a javascript function with the file name (like 123.mpg) and it will be feeded to the "val" variable above. According to that I am setting the innerHTML property. So once I click the link it will popup a video with dynamic content.

The problem is this does not work on Firefox. This works fine in IE. Is there any possibility of failing this in Firefox.

For Your Information

/Test/ShowImage?contentImageName="+val+"' will execute a servlet which will write the video file in to the servlet output stream. And if its an image instead of a video this works fine. And the MPG files i tested are larger than 5MB and less than 10 MB.

Need your help.

Thank you.

Dilshan Edirisuriya SCJP1.4, SCWCD1.4, SCBCD 5
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2904

Has your FF installed with Windows Media plugin ?

[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Dilshan Edirisuriya
Ranch Hand

Joined: Apr 22, 2006
Posts: 299
Yes its installed. I did a sample code for this and it worked perfectly. Have a look at this.

Only difference is the src is generated dynamically in my code. Here its a hard coded one just to check whether the div refresh works. Here is the coding for get the serveltout putstream for the video.

Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
If you alert the innerHTML, does the code look correct?

Dilshan Edirisuriya
Ranch Hand

Joined: Apr 22, 2006
Posts: 299
Yes it looks fine the path is displayed. Also I pasted the src url into the browser address bar and it displays the message box for mpg file. The same coding works for image type once I change the content type. But when it comes to video this occurs. Firefox doesnt render that servlet output stream as I observed.
I agree. Here's the link:
subject: Embeding a video with a dynamic "src"
It's not a secret anymore!