Re: Streaming Video?

2007-09-30 Thread Pierre Goupil
Sorry, I misunderstood your problem.

Why doesn't your "put stream into response" method work ? Do you get an
error ?

According to this page : http://osflash.org/flv

"HTTP streaming : It is possible to semi-stream flv over http using a trick
which sends the normal headers then skips forward to a desired point in the
file and moves the timestamps forward accordingly."

Your file format doesn't look trivial, I'm afraid. (If you are really
talking of the Flash Video File, of course.)

HTH,

Pierre



2007/9/30, Muhammad Momin Rashid <[EMAIL PROTECTED]>:
>
> Hello Pierre,
>
> Unless I am missing something here, this doesn't solve my problem of
> streaming
> content using a struts 2 action.  I already have a player and it works
> file if
> the video is exposed using a url e.g. http://localhost:8080/video.flv
>
> But I need to expose the video using a struts 2 action e.g.
> http://localhost:8080/View.action?videoId=12, and I am having trouble
> streaming
> video using a sturts 2 action.
>
> Regards,
> Muhammad Momin Rashid.
>
> Pierre Goupil wrote:
> > Hello,
> >
> > I once used this page :
> >
> > http://rainbow.arch.scriptmania.com/scripts/music/video.html
> >
> > This is not Struts-related but this is not hard to adapt it. I even used
> it
> > in response to an AJAX call.
> >
> > HTH,
> >
> > Pierre
> >
> >
> > 2007/9/30, Muhammad Momin Rashid <[EMAIL PROTECTED]>:
> >> Hello Everyone,
> >>
> >> Can someone guide me on how to stream video using my struts 2
> application.
> >>
> >> I have tried using the input stream method described in different
> >> thread.  while the method is working fine for images, it isn't working
> >> for video (flv) file.
> >>
> >> I also tried writing the flv file to output stream of the response, but
> >> it isn't working either.
> >>
> >> try
> >> {
> >> HttpServletResponse response = ServletActionContext.getResponse
> ();
> >>
> >> OutputStream outputStream = response.getOutputStream();
> >> File file = new File(filename);
> >> FileInputStream fileInputStream = new FileInputStream(file);
> >> byte[] buffer = new byte[1024 * 64];
> >> int bytesRead;
> >>
> >> response.setContentType("video/x-flv");
> >> response.addHeader("Content-Disposition", "attachment;
> filename="
> >> +
> >> filename);
> >> response.setContentLength((int) file.length());
> >> response.addHeader("Cache-Control", "max-age=25");
> >>
> >> while ((bytesRead = fileInputStream.read(buffer)) != -1)
> >> {
> >> outputStream.write(buffer, 0, bytesRead);
> >> }
> >> fileInputStream.close();
> >>
> >> }
> >> catch (Exception e)
> >> {
> >> }
> >> return null;
> >>
> >>
> >> Regards,
> >> Muhammad Momin Rashid.
> >>
> >>
> >> -
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >
> >
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
"Deux choses ne se peuvent cacher : l'ivresse et l'amour."
(Antiphane)


Re: Streaming Video?

2007-09-30 Thread Muhammad Momin Rashid

Hello Pierre,

Unless I am missing something here, this doesn't solve my problem of streaming 
content using a struts 2 action.  I already have a player and it works file if 
the video is exposed using a url e.g. http://localhost:8080/video.flv


But I need to expose the video using a struts 2 action e.g. 
http://localhost:8080/View.action?videoId=12, and I am having trouble streaming 
video using a sturts 2 action.


Regards,
Muhammad Momin Rashid.

Pierre Goupil wrote:

Hello,

I once used this page :

http://rainbow.arch.scriptmania.com/scripts/music/video.html

This is not Struts-related but this is not hard to adapt it. I even used it
in response to an AJAX call.

HTH,

Pierre


2007/9/30, Muhammad Momin Rashid <[EMAIL PROTECTED]>:

Hello Everyone,

Can someone guide me on how to stream video using my struts 2 application.

I have tried using the input stream method described in different
thread.  while the method is working fine for images, it isn't working
for video (flv) file.

I also tried writing the flv file to output stream of the response, but
it isn't working either.

try
{
HttpServletResponse response = ServletActionContext.getResponse();

OutputStream outputStream = response.getOutputStream();
File file = new File(filename);
FileInputStream fileInputStream = new FileInputStream(file);
byte[] buffer = new byte[1024 * 64];
int bytesRead;

response.setContentType("video/x-flv");
response.addHeader("Content-Disposition", "attachment; filename="
+
filename);
response.setContentLength((int) file.length());
response.addHeader("Cache-Control", "max-age=25");

while ((bytesRead = fileInputStream.read(buffer)) != -1)
{
outputStream.write(buffer, 0, bytesRead);
}
fileInputStream.close();

}
catch (Exception e)
{
}
return null;


Regards,
Muhammad Momin Rashid.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]








-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Streaming Video?

2007-09-30 Thread Pierre Goupil
Hello,

I once used this page :

http://rainbow.arch.scriptmania.com/scripts/music/video.html

This is not Struts-related but this is not hard to adapt it. I even used it
in response to an AJAX call.

HTH,

Pierre


2007/9/30, Muhammad Momin Rashid <[EMAIL PROTECTED]>:
>
> Hello Everyone,
>
> Can someone guide me on how to stream video using my struts 2 application.
>
> I have tried using the input stream method described in different
> thread.  while the method is working fine for images, it isn't working
> for video (flv) file.
>
> I also tried writing the flv file to output stream of the response, but
> it isn't working either.
>
> try
> {
> HttpServletResponse response = ServletActionContext.getResponse();
>
> OutputStream outputStream = response.getOutputStream();
> File file = new File(filename);
> FileInputStream fileInputStream = new FileInputStream(file);
> byte[] buffer = new byte[1024 * 64];
> int bytesRead;
>
> response.setContentType("video/x-flv");
> response.addHeader("Content-Disposition", "attachment; filename="
> +
> filename);
> response.setContentLength((int) file.length());
> response.addHeader("Cache-Control", "max-age=25");
>
> while ((bytesRead = fileInputStream.read(buffer)) != -1)
> {
> outputStream.write(buffer, 0, bytesRead);
> }
> fileInputStream.close();
>
> }
> catch (Exception e)
> {
> }
> return null;
>
>
> Regards,
> Muhammad Momin Rashid.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
"Deux choses ne se peuvent cacher : l'ivresse et l'amour."
(Antiphane)


Streaming Video?

2007-09-30 Thread Muhammad Momin Rashid

Hello Everyone,

Can someone guide me on how to stream video using my struts 2 application.

I have tried using the input stream method described in different 
thread.  while the method is working fine for images, it isn't working 
for video (flv) file.


I also tried writing the flv file to output stream of the response, but 
it isn't working either.


try
{
HttpServletResponse response = ServletActionContext.getResponse();

OutputStream outputStream = response.getOutputStream();
File file = new File(filename);
FileInputStream fileInputStream = new FileInputStream(file);
byte[] buffer = new byte[1024 * 64];
int bytesRead;

response.setContentType("video/x-flv");
	response.addHeader("Content-Disposition", "attachment; filename=" + 
filename);

response.setContentLength((int) file.length());
response.addHeader("Cache-Control", "max-age=25");

while ((bytesRead = fileInputStream.read(buffer)) != -1)
{
outputStream.write(buffer, 0, bytesRead);
}
fileInputStream.close();

}
catch (Exception e)
{
}
return null;


Regards,
Muhammad Momin Rashid.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]