[prev in list] [next in list] [prev in thread] [next in thread] 

List:       struts-user
Subject:    Re: Streaming Video?
From:       "Pierre Goupil" <goupilpierre () gmail ! com>
Date:       2007-09-30 17:47:56
Message-ID: d7579db00709301047g1d7ed447ue615319a7bca2c1d () mail ! gmail ! com
[Download RAW message or body]


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 <momin@abdere.com>:
>
> 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 <momin@abdere.com>:
> >> 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: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic