网页上播放mp3或flash
<object id="player1" type="application/x-oleobject" height="360" width="300" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"> <param NAME="AutoStart" VALUE="-1"> <!--是否自动播放--> <param NAME="url" value="D:\FireAlarm.mp3"> <!--播放的文件地址--> <param NAME="PlayCount" VALUE="1"> </object> <img src="1.jpg" onclick="player1.controls.play();" alt="播放" style="cursor:hand"> <img src="1.jpg" onclick="player1.controls.pause();" alt="暂停" style="cursor:hand"> <img src="1.jpg" onclick="player1.controls.Stop();" alt="停止" style="cursor:hand"> <img src="1.jpg" onclick="javascript:if(player1.playState==3)wmp.fullScreen=true;" alt="全屏" style="cursor:hand"> <img src="1.jpg" onclick="player1.settings.mute = !player1.settings.mute;" alt="静音" style="cursor:hand">
附一:
控制播放器控件
media player控制
对应控件 <object classid=”clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6″
player.URL = url; 设置文件来源
player.controls.play(); 播放
player.controls.stop(); 停止
player.controls.pause(); 暂停
player.controls.currentPosition 返回播放文件的当前时间位置(以秒为单位)
player.controls.currentPositionString 时间格式的字符串 “0:32”
player.currentMedia.duration 返回播放文件的总长度(以秒为单位)
player.currentMedia.durationString 时间格式的字符串 “4:34”
player.settings.volume 音量 (0-100)
player.settings.balance 声道,通过它应该可以进行立体声、左声道、右声道的控制。但对应的取值尚不清楚。
player.settings.mute = s 静音(s取值为true和false)
player.closedCaption.CaptioningID 网页中出现字幕的容器的ID
player.closedCaption.SAMIFileName 字幕文件地址
player.playState 返回播放器状态( 3:正在播放,2:暂停1:已停止)
player.fullscreen=1 全屏播放(全屏后按ESC返回)
======================================================
REAL PLAYER控制
对应控件 <object classid=”clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA”
player.DoPlay() 播放
player.DoPause() 暂停
player.DoStop() 停止
player.GetLength() 返回播放文件的总长度(以毫秒为单位)
player.GetPosition() 返回播放文件的当前时间位置(以毫秒为单位)
player.GetPlayState() 返回播放器状态(0:停止,1:连接,2:缓冲,3:播放,4:暂停,5:寻找)
player.SetPosition(n) 时间位置跳到n的地方(n取值以毫秒为单位)
player.SetVolume(n) 设置音量(n取值为0到100)
player.SetMute(s) 静音(s取值为true和false)
player.SetFullScreen() 全屏(全屏后按ESC返回)
player.setSource() 设置文件来源
<param name=”playcount” value=”1″><!–控制重复次数: “x”为几重复播放几次; x=0,无限循环。–>
<param name=”autostart” value=”0″><!–控制播放方式: x=1,打开网页自动播放; x=0,按播放键播放。–>
<param name=”clicktoplay” value=”1″><!–控制播放开关: x=1,可鼠标点击控制播放或暂停状态; x=0,禁用此功能。–>
<param name=”displaysize” value=”0″><!–控制播放画面: x=0,原始大小; x=1,一半大小; x=2,2倍大小。–>
<param name=”enablefullscreen controls” value=”1″><!–控制切换全屏: x=1,允许切换为全屏; x=0,禁用此功能。–>
<param name=”showaudio controls” value=”1″><!–控制音量: x=1,允许调节音量; x=0,禁止音量调节。–>
<param name=”enablecontext menu” value=”1″><!–控制快捷菜单: x=1,允许使用右键菜单; x=0,禁用右键菜单。–>
<param name=”showdisplay” value=”1″><!–控制版权信息: x=1,显示电影及作者信息;x=0,不显示相关信息–>
<param NAME=”AutoStart” VALUE=”-1″><!–是否自动播放–>
<param NAME=”Balance” VALUE=”0″><!–调整左右声道平衡,同上面旧播放器代码–>
<param name=”enabled” value=”-1″><!–播放器是否可人为控制–>
<param NAME=”EnableContextMenu” VALUE=”-1″><!–是否启用上下文菜单–>
<param NAME=”url” VALUE=”http://1.wma“> <!–播放的文件地址–><param NAME=”PlayCount” VALUE=”1″><!–播放次数控制,为整数–>
<param name=”rate” value=”1″><!–播放速率控制,1为正常,允许小数,1.0-2.0–>
<param name=”currentPosition” value=”0″><!–控件设置:当前位置–>
<param name=”currentMarker” value=”0″><!–控件设置:当前标记–>
<param name=”defaultFrame” value=””><!–显示默认框架–>
<param name=”invokeURLs” value=”0″><!–脚本命令设置:是否调用URL–>
<param name=”baseURL” value=””><!–脚本命令设置:被调用的URL–>
<param name=”stretchToFit” value=”0″><!–是否按比例伸展–>
<param name=”volume” value=”50″><!–默认声音大小0%-100%,50则为50%–>
<param name=”mute” value=”0″><!–是否静音–
<param name=”uiMode” value=”mini”><!–播放器显示模式:Full显示全部;mini最简化;None不显示播放控制,只显示视频窗口;invisible全部不显示–><param name=”windowlessVideo” value=”0″><!–如果是0可以允许全屏,否则只能在窗口中查看–>
<param name=”fullScreen” value=”0″><!–开始播放是否自动全屏–>
<param name=”enableErrorDialogs” value=”-1″><!–是否启用错误提示报告–>
<param name=”SAMIStyle” value><!–SAMI样式–>
<param name=”SAMIFilename” value><!–字幕ID–>
插入rm格式视频:
<object id=”player” name=”player” classid=”clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA” width=”339″ height=”227″>
<param name=”_ExtentX” value=”9869″>
<param name=”_ExtentY” value=”7726″>
<param name=”AUTOSTART” value=”-1″>
<param name=”SHUFFLE” value=”0″>
<param name=”PREFETCH” value=”0″>
<param name=”NOLABELS” value=”-1″>
<param name=”SRC” value=”http://entdown.163.com/ent/garbage/mv/1028/xuemv.rm“>
<param name=”CONTROLS” value=”Imagewindow”>
<param name=”CONSOLE” value=”clip1″>
<param name=”LOOP” value=”0″>
<param name=”NUMLOOP” value=”0″>
<param name=”CENTER” value=”0″>
<param name=”MAINTAINASPECT” value=”0″>
<param name=”BACKGROUNDCOLOR” value=”#000000″>
</object>
1.avi格式
<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=180 id=NSPlay type=application/x-oleobject width=240
VIEWASTEXT standby=”加载 Microsoft Windows Media Player 组件…”>
<param name=”FileName” value=””>
<param name=”AutoStart” value=”true”>
<param name=”AutoRewind” value=”-1″>
<param name=”AnimationAtStart” value=”false”>
<param name=”ShowControls” value=”false”>
<param name=”ClickToPlay” value=”false”>
<param name=”EnableContextMenu” value=”true”>
<param name=”EnablePositionControls” value=”false”>
<param name=”Balance” value=”0″>
<param name=”ShowStatusBar” value=”false”>
<param name=”AutoSize” value=”0″>
<embed type=”application/x-mplayer2″
pluginspage=”http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/”
filename src
enablecontextmenu=”false”
clicktoplay=”false”
enablepositioncontrols=”false”
showcontrols=”0″ showstatusbar=”1″
showdisplay=”0″ width=”240″ height=”180″>
</embed>
</object>
或者
<object id=”video” width=”400″ height=”200″ border=”0″
classid=”clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA”>
<param name=”ShowDisplay” value=”0″>
<param name=”ShowControls” value=”1″>
<param name=”AutoStart” value=”1″>
<param name=”AutoRewind” value=”0″>
<param name=”PlayCount” value=”0″>
<param name=”Appearance value=”0 value=”””>
<param name=”BorderStyle value=”0 value=”””>
<param name=”MovieWindowHeight” value=”240″>
<param name=”MovieWindowWidth” value=”320″>
<param name=”FileName” value=”file:///D|/work/vod/Mbar.avi”>
<embed width=”400″ height=”200″ border=”0″ showdisplay=”0″ showcontrols=”1″
playcount=”0″ moviewindowheight=”240″ moviewindowwidth=”320″
filename=”file:///D|/work/vod/Mbar.avi” src=”Mbar.avi”>
</embed>
</object>
2.mpg格式
<object classid=”clsid:05589FA1-C356-11CE-BF01-00AA0055595A” id=”ActiveMovie1″
width=”239″ height=”250″>
<param name=”Appearance” value=”0″>
<param name=”AutoStart” value=”-1″>
<param name=”AllowChangeDisplayMode” value=”-1″>
<param name=”AllowHideDisplay” value=”0″>
<param name=”AllowHideControls” value=”-1″>
<param name=”AutoRewind” value=”-1″>
<param name=”Balance” value=”0″>
<param name=”CurrentPosition” value=”0″>
<param name=”DisplayBackColor” value=”0″>
<param name=”DisplayForeColor” value=”16777215″>
<param name=”DisplayMode” value=”0″>
<param name=”Enabled” value=”-1″>
<param name=”EnableContextMenu” value=”-1″>
<param name=”EnablePositionControls” value=”-1″>
<param name=”EnableSelectionControls” value=”0″>
<param name=”EnableTracker” value=”-1″>
<param name=”Filename” value=”http://www.cnblogs.com/../mpeg/halali.mpg” valuetype=”ref”>
<param name=”FullScreenMode” value=”0″>
<param name=”MovieWindowSize” value=”0″>
<param name=”PlayCount” value=”1″>
<param name=”Rate” value=”1″>
<param name=”SelectionStart” value=”-1″>
<param name=”SelectionEnd” value=”-1″>
<param name=”ShowControls” value=”-1″>
<param name=”ShowDisplay” value=”-1″>
<param name=”ShowPositionControls” value=”0″>
<param name=”ShowTracker” value=”-1″>
<param name=”Volume” value=”-480″>
</object>
3.smi格式
<OBJECT id=RVOCX classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA width=240
height=180>
<param name=”_ExtentX” value=”6350″>
<param name=”_ExtentY” value=”4763″>
<param name=”AUTOSTART” value=”-1″>
<param name=”SHUFFLE” value=”0″>
<param name=”PREFETCH” value=”0″>
<param name=”NOLABELS” value=”-1″>
<param name=”SRC” value=”rm.rm”>
<param name=”CONTROLS” value=”ImageWindow”>
<param name=”CONSOLE” value=”console1″>
<param name=”LOOP” value=”0″>
<param name=”NUMLOOP” value=”0″>
<param name=”CENTER” value=”0″>
<param name=”MAINTAINASPECT” value=”0″>
<param name=”BACKGROUNDCOLOR” value=”#000000″><embed src=”real.smi”
type=”audio/x-pn-realaudio-plugin” console=”Console1″ controls=”ImageWindow”
height=”180″ width=”240″ ></OBJECT>
5.wmv格式
<object id=”NSPlay” width=200 height=180
classid=”CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95″
codebase=”http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab
#Version=6,4,5,715″
standby=”Loading Microsoft Windows Media Player components…”
type=”application/x-oleobject” align=”right” hspace=”5″>
<!- ASX File Name ->
<param name=”AutoRewind” value=1>
<param name=”FileName” value=”xxxxxx.wmv”>
<!- Display Controls ->
<param name=”ShowControls” value=”1″>
<!- Display Position Controls ->这个参数是用来决定是否显示播放进度条的控制的
<param name=”ShowPositionControls” value=”0″>
<!- Display Audio Controls ->这个参数是用来定义是否显示音量控制按钮的
<param name=”ShowAudioControls” value=”1″>
<!- Display Tracker Controls ->这个参数是用来定义是否可以控制声道的
<param name=”ShowTracker” value=”0″>
<!- Show Display ->
<param name=”ShowDisplay” value=”0″>
<!- Display Status Bar ->这个参数是用来定义是否显示播放状态栏的
<param name=”ShowStatusBar” value=”0″>
<!- Diplay Go To Bar ->
<param name=”ShowGotoBar” value=”0″>
<!- Display Controls ->这个参数是用来定义是否显示控制面板的
<param name=”ShowCaptioning” value=”0″>
<!- Player Autostart ->这个参数是用来定义是否自动播放的
<param name=”AutoStart” value=1>
<!- Animation at Start ->
<param name=”Volume” value=”-2500″>
<param name=”AnimationAtStart” value=”0″>
<!- Transparent at Start ->这个参数是用来定义视频文件的透明度的
<param name=”TransparentAtStart” value=”0″>
<!- Do not allow a change in display size ->
<param name=”AllowChangeDisplaySize” value=”0″>
<!- Do not allow scanning ->这个参数是用来定义是否允许拖动进度条
<param name=”AllowScan” value=”0″>
<!- Do not show contect menu on right mouse click ->这个参数是用来定义是否允许在视频播放区域点右键
<param name=”EnableContextMenu” value=”0″>
<!- Do not allow playback toggling on mouse click ->
<param name=”ClickToPlay value=”0″>
</object>