How to play video using Servlet or JSP?
How to play video using 开发者_运维知识库Servlet or JSP?
In JSP, it's not different from as you would do in normal HTML. Just use the <embed>
and/or the <object>
element which points to an URL where the video file is located. You need to consult the documentation of the video format vendor for details how to use it. Since you didn't mention what format the video file is in, we can't help you further in detail. So here's just one example: in case of Quicktime .mov
files, you can consult it at Apple.
A servlet is only useful if you haven't stored the video file in public webcontent. But still then, it's nothing special which needs to be done by the servlet. Just read InputStream
from the file source (somewhere else on fixed disk, or in a database, etc) and write to OutputStream
of the response along a correct set of response headers.
精彩评论