Web ブラウザで動画を再生したい。以下の html コードは、Google クロームでは正常に動作しますが、IE および Firefox では動作しません。サーバー上の c:/ から .avi ファイルを取得し、それをバイト ストリームに変換して、バイトを応答として送信しています。
ここにコードを入力してください
<html>
<body>
<object id="MediaPlayer" width="192" height="146" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" standby="Loading Windows Media Player components..." type="application/x-oleobject">
<param name="SRC" value="dg">
<param name="ShowControls" value="false">
<param name="ShowStatusBar" value="false">
<param name="ShowDisplay" value="false">
<param name="autostart" value="true">
<embed type="application/x-mplayer2" src="http://125.60.35.36:8888/sa/jsp/common/showVideo.jsp?path=library/2013/Video/sample_1362996503283.avi" name="MediaPlayer" width="400" height="300" showcontrols="1" showstatusbar="0" showdisplay="0" autostart="0">
</object>
</body>
</html>
ここにコードを入力してください
String filePath = "c:/sa/documents/"+request.getParameter("path");
System.out.println(filePath);
InputStream is=new FileInputStream(filePath);
OutputStream os=response.getOutputStream();
//OutputStream os=new FileOutputStream("c:/test.avi");
byte b[]=IOUtils.toByteArray(is);
os.write(b,0,b.length);
os.close();
is.close();