81,090
社区成员
发帖
与我相关
我的任务
分享
<OBJECT classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
codeBase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"
height="256" id="MIDIPlayer" name="wmplayer"
type="application/x-oleobject"
width="320"
standby="加载 Microsoft Windows Media Player 组件..." VIEWASTEXT>
<PARAM NAME="src" VALUE="你要播放的文件">
<PARAM NAME="AutoStart" VALUE="true">
<PARAM NAME="AutoRewind" VALUE="true">
<PARAM NAME="AnimationAtStart" VALUE="false">
<PARAM NAME="ShowControls" VALUE="true">
<PARAM NAME="ClickToPlay" VALUE="true">
<PARAM NAME="EnableContextMenu" VALUE="true">
<PARAM NAME="EnablePositionControls" VALUE="true">
<PARAM NAME="Balance" VALUE="0">
<PARAM NAME="ShowStatusBar" VALUE="true">
<PARAM NAME="AutoSize" VALUE="0">
<PARAM NAME="PlayCount" VALUE="0">
<embed type="application/x-mplayer2" src="你要播放的文件" autostart="true" height="256" width="320">
</embed>
</OBJECT>
//调用Windows播放器
Runtime.getRuntime().exec(String cmd);
import java.io.IOException;
public class TestExecPlayer {
public static void main(String args[]){
String thePlayerPath = "C: \\Program Files \\Windows Media Player \\wmplayer.exe"; /*播放器的路径*/
try{
Process ps = Runtime.getRuntime().exec(thePlayerPath);
}catch (IOException e){ e.printStackTrace();
}
}
}