在网页中插入视频播放代码全集

1.wma,wmv格式的文件播放

<object classid=clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95 id=MediaPlayer width="512" height="357" align=middle >
              <param name=AudioStream value=-1>
              <param name=AutoSize value=1>
              <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=BufferingTime value=5>
              <param name=ClickToPlay value=1>
              <param name=CursorType value=0>
              <param name=CurrentPosition value=-1>
              <param name=CurrentMarker value=0>
              <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=0>
              <param name=EnablePositionControls value=-1>
              <param name=EnableFullScreenControls value=0>
              <param name=EnableTracker value=-1>
              <param name=Filename value=${thisForm.filePath }>//这个地方可以是针对你服务器的相对路径或绝对路径,例如/Kindergarden/Upload/messageImages/2010-1-8-16-50-29.wma
              <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=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=-1>
              <param name=SendMouseMoveEvents value=-1>
              <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=1>
              <param name=VideoBorderColor value=0>
              <param name=VideoBorder3D value=0>
              <param name=Volume value=-40>
              <param name=WindowlessVideo value=0>
             </object>

 

2.rm格式

<object
                align=middle
                classid=CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95
                class=OBJECT id=MediaPlayer width=384 height=348 >
                    <param name=ShowStatusBar value=1>
                    <param name=Filename value="<%=sLocalRealPath%>${thisForm.filePath }">
            </object>

对于RM格式的文件必须是你当前系统盘的绝对路径,例如:

E:/Tomcat 6.0/webapps/Kindergarden/Upload/messageImages/2010-1-8-16-50-29.rm

如果你是在JSP页面中调用的话,可以通过以下方法来得到当前盘符的绝对路径:

以下是写在JSP页面的

String sLocalRealPath = application.getRealPath("/").replace("\\","/");
  sLocalRealPath=sLocalRealPath.substring(0,sLocalRealPath.lastIndexOf("Kindergarden"));

因为我的应用是放在E:/Tomcat 6.0/webapps/Kindergarden目录下,所以我只要截取到Kindergarden字符位置,然后拼接我具体视频文件保存的相对路径,

如:"<%=sLocalRealPath%>=E:/Tomcat 6.0/webapps、

${thisForm.filePath }=/Kindergarden/Upload/messageImages/2010-1-8-16-50-29.rm

所以拼接后就得到具体视频文件地址

你可能感兴趣的:(tomcat,jsp,应用服务器)