2 Replies Latest reply: Apr 9, 2007 12:28 PM by 807599 RSS

    streaming video

    807599
      I have been researching how to do streaming video in java, and have come up short with references on how to do this and some source code to reference.

      I was wondering if it would be possible to have a server send a byte[] of like 100 and then write that to a file, appending the file each time a new byte[] is received. and then just play that file in a media player.

      thanks for your help.
        • 1. Re: streaming video
          807599
          That would work. Check out the socket tutorial on how to read data from a socket: http://java.sun.com/docs/books/tutorial/networking/sockets/index.html

          Although writing to a file isn't really streaming a video, it's more like download and play. If you want to do real streaming (like a continuous surveillance video camera feed, or videoconferencing, where you can't wait for the end of the file), that's more complicated. For real streaming, I'd start by googling for java video streaming, maybe someone has a more direct reference...?
          • 2. Re: streaming video
            807599
            writing the file wouldn't be streaming the video, i was more thinking along the lines that it would give the streaming effect. because i am wanting to send a video from a server to display on a client. but if i pull the whole video into a byte[] and then send it to be written to a file, it becomes a slow process, and can take about 2 mins for files that are only 4,000kb. so i wondered if by sending it in like 300-400kb chunks and writing to the file if that would work.

            also if i were to do it that way, if the video were to hit the end of the file before it was completely sent, would it then stop or would it pause?

            thanks for your help