用Media Player 播放 mpg檔案
先說明的是此mpg檔案,如果不安裝一個Media Player Filter包,Media Player 是不能播放的,所以在每臺機器上都安裝了Media Player Filter包。
1.頁面上播放mpg檔案,如果向下面這樣,能正常播放,(filename 引數直接寫檔名稱<param name="Filename" value="d://clip.mpg">)
<object classid=CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95
id=NSPlay type=application/x-oleobject width="390" height="390">
<param name="AudioStream" value="-1">
<param name="AutoSize" value="0">
<param name="AutoStart" value="-1">
<param name="AnimationAtStart" value="-1">
<param name="AllowScan" value="-1">
<param name="AllowChangeDisplaySize" value="-1">
<param name="AutoRewind" value="0">
<param name="Balance" value="0">
<param name="BaseURL" value>
<param name="BufferingTime" value="5">
<param name="CaptioningID" value>
<param name="ClickToPlay" value="-1">
<param name="CursorType" value="0">
<param name="CurrentPosition" value="-1">
<param name="CurrentMarker" value="0">
<param name="DefaultFrame" value>
<param name="DisplayBackColor" value="0">
<param name="DisplayForeColor" value="16777215">
<param name="DisplayMode" value="0">
<param name="DisplaySize" value="2">
<param name="Enabled" value="-1">
<param name="EnableContextMenu" value="-1">
<param name="EnablePositionControls" value="-1">
<param name="EnableFullScreenControls" value="0">
<param name="EnableTracker" value="-1">
<param name="InvokeURLs" value="-1">
<param name="Language" value="-1">
<param name="Mute" value="0">
<param name="PlayCount" value="1">
<param name="PreviewMode" value="0">
<param name="Rate" value="1">
<param name="SAMILang" value>
<param name="SAMIStyle" value>
<param name="SAMIFileName" value>
<param name="SelectionStart" value="-1">
<param name="SelectionEnd" value="-1">
<param name="SendOpenStateChangeEvents" value="-1">
<param name="SendWarningEvents" value="-1">
<param name="SendErrorEvents" value="-1">
<param name="SendKeyboardEvents" value="0">
<param name="SendMouseClickEvents" value="0">
<param name="SendMouseMoveEvents" value="0">
<param name="SendPlayStateChangeEvents" value="-1">
<param name="ShowCaptioning" value="0">
<param name="ShowControls" value="-1">
<param name="ShowAudioControls" value="-1">
<param name="ShowDisplay" value="0">
<param name="ShowGotoBar" value="0">
<param name="ShowPositionControls" value="-1">
<param name="ShowStatusBar" value="-1">
<param name="ShowTracker" value="-1">
<param name="TransparentAtStart" value="0">
<param name="VideoBorderWidth" value="0">
<param name="VideoBorderColor" value="0">
<param name="VideoBorder3D" value="0">
<param name="Volume" value="-40">
<param name="WindowlessVideo" value="0">
<param name="Filename" value="d://clip.mpg">
<!--
value="</%=basePath%>servlet/imageViewer?key=21">
-->
</object>
2.如果向下面這樣,不能正常播放,(filename 引數直接寫檔名稱<param name="Filename" value="http://127.0.0.1:8080/dzgl/show/test.jsp?key=1&from=1">)
<object classid=CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95
id=NSPlay type=application/x-oleobject width="390" height="390">
<param name="AudioStream" value="-1">
<param name="AutoSize" value="0">
<param name="AutoStart" value="-1">
<param name="AnimationAtStart" value="-1">
<param name="AllowScan" value="-1">
<param name="AllowChangeDisplaySize" value="-1">
<param name="AutoRewind" value="0">
<param name="Balance" value="0">
<param name="BaseURL" value>
<param name="BufferingTime" value="5">
<param name="CaptioningID" value>
<param name="ClickToPlay" value="-1">
<param name="CursorType" value="0">
<param name="CurrentPosition" value="-1">
<param name="CurrentMarker" value="0">
<param name="DefaultFrame" value>
<param name="DisplayBackColor" value="0">
<param name="DisplayForeColor" value="16777215">
<param name="DisplayMode" value="0">
<param name="DisplaySize" value="2">
<param name="Enabled" value="-1">
<param name="EnableContextMenu" value="-1">
<param name="EnablePositionControls" value="-1">
<param name="EnableFullScreenControls" value="0">
<param name="EnableTracker" value="-1">
<param name="InvokeURLs" value="-1">
<param name="Language" value="-1">
<param name="Mute" value="0">
<param name="PlayCount" value="1">
<param name="PreviewMode" value="0">
<param name="Rate" value="1">
<param name="SAMILang" value>
<param name="SAMIStyle" value>
<param name="SAMIFileName" value>
<param name="SelectionStart" value="-1">
<param name="SelectionEnd" value="-1">
<param name="SendOpenStateChangeEvents" value="-1">
<param name="SendWarningEvents" value="-1">
<param name="SendErrorEvents" value="-1">
<param name="SendKeyboardEvents" value="0">
<param name="SendMouseClickEvents" value="0">
<param name="SendMouseMoveEvents" value="0">
<param name="SendPlayStateChangeEvents" value="-1">
<param name="ShowCaptioning" value="0">
<param name="ShowControls" value="-1">
<param name="ShowAudioControls" value="-1">
<param name="ShowDisplay" value="0">
<param name="ShowGotoBar" value="0">
<param name="ShowPositionControls" value="-1">
<param name="ShowStatusBar" value="-1">
<param name="ShowTracker" value="-1">
<param name="TransparentAtStart" value="0">
<param name="VideoBorderWidth" value="0">
<param name="VideoBorderColor" value="0">
<param name="VideoBorder3D" value="0">
<param name="Volume" value="-40">
<param name="WindowlessVideo" value="0">
<param name="Filename" value="http://127.0.0.1:8080/dzgl/show/test.jsp?key=1&from=1">
<!--
value="</%=basePath%>servlet/imageViewer?key=21">
-->
</object>
/show/test.jsp 如下:
<%@ page language="java"%>
<%@ page import="java.io.*"%>
<%
response.setContentType("bin");
int maxBufferLength = 81920;
byte[] b = new byte[maxBufferLength];
InputStream fs = new FileInputStream("d://Clip.mpg"); // 不能正常播放
//InputStream fs = new FileInputStream("d://speedis.avi");
// b = new byte[fs.available()];
b = new byte[maxBufferLength];
DataOutputStream outTmp = new DataOutputStream(response.getOutputStream());
int len;
try {
if (fs != null) {
while ((len = fs.read(b)) > 0) {
outTmp.write(b, 0, len); //這出的錯
}
} catch (Exception e) {
e.printStackTrace();
}
}finally{
outTmp.close();
}
%>
第2種方法出現的異常是:
ClientAbortException: java.net.SocketException: Connection reset by peer: socket write error
問: 我要的是第2種方法,因為需要從資料庫中讀出檔案內容。不知道第2種方法為什麼不正常播放。
1.頁面上播放mpg檔案,如果向下面這樣,能正常播放,(filename 引數直接寫檔名稱<param name="Filename" value="d://clip.mpg">)
<object classid=CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95
id=NSPlay type=application/x-oleobject width="390" height="390">
<param name="AudioStream" value="-1">
<param name="AutoSize" value="0">
<param name="AutoStart" value="-1">
<param name="AnimationAtStart" value="-1">
<param name="AllowScan" value="-1">
<param name="AllowChangeDisplaySize" value="-1">
<param name="AutoRewind" value="0">
<param name="Balance" value="0">
<param name="BaseURL" value>
<param name="BufferingTime" value="5">
<param name="CaptioningID" value>
<param name="ClickToPlay" value="-1">
<param name="CursorType" value="0">
<param name="CurrentPosition" value="-1">
<param name="CurrentMarker" value="0">
<param name="DefaultFrame" value>
<param name="DisplayBackColor" value="0">
<param name="DisplayForeColor" value="16777215">
<param name="DisplayMode" value="0">
<param name="DisplaySize" value="2">
<param name="Enabled" value="-1">
<param name="EnableContextMenu" value="-1">
<param name="EnablePositionControls" value="-1">
<param name="EnableFullScreenControls" value="0">
<param name="EnableTracker" value="-1">
<param name="InvokeURLs" value="-1">
<param name="Language" value="-1">
<param name="Mute" value="0">
<param name="PlayCount" value="1">
<param name="PreviewMode" value="0">
<param name="Rate" value="1">
<param name="SAMILang" value>
<param name="SAMIStyle" value>
<param name="SAMIFileName" value>
<param name="SelectionStart" value="-1">
<param name="SelectionEnd" value="-1">
<param name="SendOpenStateChangeEvents" value="-1">
<param name="SendWarningEvents" value="-1">
<param name="SendErrorEvents" value="-1">
<param name="SendKeyboardEvents" value="0">
<param name="SendMouseClickEvents" value="0">
<param name="SendMouseMoveEvents" value="0">
<param name="SendPlayStateChangeEvents" value="-1">
<param name="ShowCaptioning" value="0">
<param name="ShowControls" value="-1">
<param name="ShowAudioControls" value="-1">
<param name="ShowDisplay" value="0">
<param name="ShowGotoBar" value="0">
<param name="ShowPositionControls" value="-1">
<param name="ShowStatusBar" value="-1">
<param name="ShowTracker" value="-1">
<param name="TransparentAtStart" value="0">
<param name="VideoBorderWidth" value="0">
<param name="VideoBorderColor" value="0">
<param name="VideoBorder3D" value="0">
<param name="Volume" value="-40">
<param name="WindowlessVideo" value="0">
<param name="Filename" value="d://clip.mpg">
<!--
value="</%=basePath%>servlet/imageViewer?key=21">
-->
</object>
2.如果向下面這樣,不能正常播放,(filename 引數直接寫檔名稱<param name="Filename" value="http://127.0.0.1:8080/dzgl/show/test.jsp?key=1&from=1">)
<object classid=CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95
id=NSPlay type=application/x-oleobject width="390" height="390">
<param name="AudioStream" value="-1">
<param name="AutoSize" value="0">
<param name="AutoStart" value="-1">
<param name="AnimationAtStart" value="-1">
<param name="AllowScan" value="-1">
<param name="AllowChangeDisplaySize" value="-1">
<param name="AutoRewind" value="0">
<param name="Balance" value="0">
<param name="BaseURL" value>
<param name="BufferingTime" value="5">
<param name="CaptioningID" value>
<param name="ClickToPlay" value="-1">
<param name="CursorType" value="0">
<param name="CurrentPosition" value="-1">
<param name="CurrentMarker" value="0">
<param name="DefaultFrame" value>
<param name="DisplayBackColor" value="0">
<param name="DisplayForeColor" value="16777215">
<param name="DisplayMode" value="0">
<param name="DisplaySize" value="2">
<param name="Enabled" value="-1">
<param name="EnableContextMenu" value="-1">
<param name="EnablePositionControls" value="-1">
<param name="EnableFullScreenControls" value="0">
<param name="EnableTracker" value="-1">
<param name="InvokeURLs" value="-1">
<param name="Language" value="-1">
<param name="Mute" value="0">
<param name="PlayCount" value="1">
<param name="PreviewMode" value="0">
<param name="Rate" value="1">
<param name="SAMILang" value>
<param name="SAMIStyle" value>
<param name="SAMIFileName" value>
<param name="SelectionStart" value="-1">
<param name="SelectionEnd" value="-1">
<param name="SendOpenStateChangeEvents" value="-1">
<param name="SendWarningEvents" value="-1">
<param name="SendErrorEvents" value="-1">
<param name="SendKeyboardEvents" value="0">
<param name="SendMouseClickEvents" value="0">
<param name="SendMouseMoveEvents" value="0">
<param name="SendPlayStateChangeEvents" value="-1">
<param name="ShowCaptioning" value="0">
<param name="ShowControls" value="-1">
<param name="ShowAudioControls" value="-1">
<param name="ShowDisplay" value="0">
<param name="ShowGotoBar" value="0">
<param name="ShowPositionControls" value="-1">
<param name="ShowStatusBar" value="-1">
<param name="ShowTracker" value="-1">
<param name="TransparentAtStart" value="0">
<param name="VideoBorderWidth" value="0">
<param name="VideoBorderColor" value="0">
<param name="VideoBorder3D" value="0">
<param name="Volume" value="-40">
<param name="WindowlessVideo" value="0">
<param name="Filename" value="http://127.0.0.1:8080/dzgl/show/test.jsp?key=1&from=1">
<!--
value="</%=basePath%>servlet/imageViewer?key=21">
-->
</object>
/show/test.jsp 如下:
<%@ page language="java"%>
<%@ page import="java.io.*"%>
<%
response.setContentType("bin");
int maxBufferLength = 81920;
byte[] b = new byte[maxBufferLength];
InputStream fs = new FileInputStream("d://Clip.mpg"); // 不能正常播放
//InputStream fs = new FileInputStream("d://speedis.avi");
// b = new byte[fs.available()];
b = new byte[maxBufferLength];
DataOutputStream outTmp = new DataOutputStream(response.getOutputStream());
int len;
try {
if (fs != null) {
while ((len = fs.read(b)) > 0) {
outTmp.write(b, 0, len); //這出的錯
}
} catch (Exception e) {
e.printStackTrace();
}
}finally{
outTmp.close();
}
%>
第2種方法出現的異常是:
ClientAbortException: java.net.SocketException: Connection reset by peer: socket write error
問: 我要的是第2種方法,因為需要從資料庫中讀出檔案內容。不知道第2種方法為什麼不正常播放。
相關文章
- Windows Media Player播放器(VC++ 2008)Windows播放器C++
- 設定 Windows Media Player 推薦設定的登錄檔檔案Windows
- Android Media playerAndroid
- win10 media player閃退怎麼辦_win10 media player閃退解決方法Win10
- win10系統media player不能用怎麼修復_win10系統media player不能用如何處理Win10
- win10 v2004版解除安裝自帶的media player播放器的方法Win10播放器
- win10 xv檔案用什麼播放器開啟_win10系統xv檔案用哪個播放器可以播放Win10播放器
- Mac影片播放器Elmedia Player for MacMac播放器
- Elmedia Player pro for Mac(影片播放器)Mac播放器
- Elmedia Player for Mac(Mac影片播放器)Mac播放器
- 如何播放 WAV 檔案?
- Elmedia Video Player pro for mac - 蘋果專用視訊播放器IDEMac蘋果播放器
- Fig Player for Mac(多媒體播放器) 1.3.7啟用版Mac播放器
- 如何用VLC Media Player Mac對影片進行剪輯!Mac
- Mac影片播放器——Elmedia Player Pro for MacMac播放器
- android播放swf檔案Android
- Django 教程之media和static靜態檔案Django
- Elmedia Video Player pro Mac影片播放器IDEMac播放器
- vlc qt player 播放器開發例項QT播放器
- 多功能音樂播放器:MP Player for Mac v3.3.2啟用版播放器Mac
- 大型WAV檔案的播放 (轉)
- CVE-2012-0003 Microsoft Windows Media Player ‘winmm.dll’ MIDI檔案解析遠端程式碼執行漏洞 分析ROSWindows
- Cisdem Video Player for Mac(萬能影片播放器) v5.0.0啟用版IDEMac播放器
- Vidmore Player for mac(藍光和DVD播放器) v1.0.12啟用版Mac播放器
- 基於Flutter Video_Player實現倍速播放FlutterIDE
- Cisdem Video Player for mac(高清視訊播放器)IDEMac播放器
- 多功能藍光播放器:Vidmore Player Mac播放器Mac
- 萬 能影片播放器:Cisdem Video Player for Mac播放器IDEMac
- 開源安卓播放器:Dolphin Player 簡單分析安卓播放器
- zyplayer下載?全網播放器ZY Player 2.6.3中文版附原始檔播放器
- 萬 能藍光播放器:Apeaksoft Blu-ray Player啟用最新版播放器
- ?zyplayer官方哪裡找?zy player影片播放器好用?播放器
- Win10系統怎麼播放AVI格式檔案_win10如何使用自帶播放器播放avi格式檔案Win10播放器
- VC2008 Windows Media Player控制元件的使用技巧(三)Windows控制元件
- C# WinForm 新增Windows Media Player 控制元件除錯出現未能載入檔案或程式集Interop.WMPLib,該怎麼解決...C#ORMWindows控制元件除錯
- 如何在Android上播放swf檔案Android
- 播放SD卡上全部音訊檔案SD卡音訊
- 播放嵌入資源的聲音檔案