http://liuyanhui.iteye.com/blog/398004
有5种方法
1.最通用的标签是:
<embed src="文件名">
其中文件名可以取任何一种多媒体文件格式,例如 "a.wma",就会在网页上显示一个 Windows Media Player 播放器(因为 wma 是 WMP 专用的),另如 "a.rm",就会在网页上显示一个 Real Player 播放器——当然,你的计算机上必须安装了 RealPlayer 才可以显示。
其实 embed 标签还可以显示 Flash 动画(这时embed 标签的作用跟用 object 标签显示 Flash 动画的差不多),例子: <embed src="a.swf">
总之,归纳 embed 标签的作用: 在网页上播放指定的多媒体文件
2.网页播放的视频代码
第一种是通过调用window media player进行播放诸如:wmv,asf等格式文件:
第二种是通过调用replayer进行播放诸如:rm,ram等格式文件
播放框:
控制框:可紧跟播放框一起
如何实现多媒体在线播放的功能
解决思路:
不同的媒体文件,都必须用相应的播放器播放,所以不同的媒体文件在线播放的代码也是不一样的。
具体步骤:
1.用RealPlay或RealOne播放的代码:
运行效果:
图1.8.5 网页中调用RealOne播放器
要知道更多更详细的属性及控制方法,请参考:
http://service.real.com/help/library/guides/extend/embed.htm
2.用Windows Media Player。
运行效果:
图1.8.6网页中调用Media Player
要了解更多关于网页中的Media Player,请参考:
http://msdn.microsoft.com/library/en-us/dnwmt/html/adding_windows_media_to_web_pages__etse.asp?frame=true
http://msdn.microsoft.com/library/en-us/dnwmt/html/webdevtech.asp?frame=true
3. 用QuickTime播放。
代码运行效果:
图1.8.7 网页中调用QuickTime播放器
要知道更高级的用法及控制方法,请参考:
http://developer.apple.com/quicktime/quicktimeintro/tools/embed.html
http://developer.apple.com/quicktime/quicktimeintro/tools/embed2.html
http://developer.apple.com/internet/ieembedprep.html
http://developer.apple.com/quicktime/compatibility.html
http://developer.apple.com/documentation/QuickTime/QT6WhatsNew/Chap1/chapter_1_section_55.html
4.Shockwave。
代码运行效果:
图1.8.8 网页中调用Shockwave播放器
参考资料:
http://www.macromedia.com/devnet/mx/dreamweaver/articles/flash_satay.html
http://www.macromedia.com/devnet/activecontent/articles/devletter.html
http://www.macromedia.com/support/flash/ts/documents/java_script_comm.htm
http://www.macromedia.com/support/director/ts/documents/sw1parameter.htm
http://www.macromedia.com/support/director/internet/shockmachine_for_d8/shockmachine_for_d809.html
5.Flash。
1.最通用的标签是:
<embed src="文件名">
其中文件名可以取任何一种多媒体文件格式,例如 "a.wma",就会在网页上显示一个 Windows Media Player 播放器(因为 wma 是 WMP 专用的),另如 "a.rm",就会在网页上显示一个 Real Player 播放器——当然,你的计算机上必须安装了 RealPlayer 才可以显示。
其实 embed 标签还可以显示 Flash 动画(这时embed 标签的作用跟用 object 标签显示 Flash 动画的差不多),例子: <embed src="a.swf">
总之,归纳 embed 标签的作用: 在网页上播放指定的多媒体文件
2.网页播放的视频代码
第一种是通过调用window media player进行播放诸如:wmv,asf等格式文件:
- <object align=middle class=OBJECT classid=CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95 height=320 id=MediaPlayer width=356>
- <param name="ShowStatusBar" value="-1">
- <param name="Filename" value="电影地址">
- <embed type=application/x-oleobject codebase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701 flename=mp src=电影地址 width=356 height=320>
- </embed>
- </object>
<object align=middle class=OBJECT classid=CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95 height=320 id=MediaPlayer width=356>
<param name="ShowStatusBar" value="-1">
<param name="Filename" value="电影地址">
<embed type=application/x-oleobject codebase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701 flename=mp src=电影地址 width=356 height=320>
</embed>
</object>
第二种是通过调用replayer进行播放诸如:rm,ram等格式文件
播放框:
- <object classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA height=285 id=RAOCX name=rmplay width=356>
- <param name="SRC" value="影片地址">
- <param name="CONSOLE" value="Clip1">
- <param name="CONTROLS" value="imagewindow">
- <param name="AUTOSTART" value="true">
- <embed src="影片地址" autostart="true" controls="ImageWindow" console="Clip1" pluginspage="http://www.real.com"/’ target="_blank" >http://www.real.com"; width="356" height="285">
- </embed>
- </object>
<object classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA height=285 id=RAOCX name=rmplay width=356>
<param name="SRC" value="影片地址">
<param name="CONSOLE" value="Clip1">
<param name="CONTROLS" value="imagewindow">
<param name="AUTOSTART" value="true">
<embed src="影片地址" autostart="true" controls="ImageWindow" console="Clip1" pluginspage="http://www.real.com"/’ target="_blank" >http://www.real.com"; width="356" height="285">
</embed>
</object>
控制框:可紧跟播放框一起
- <object classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA height=27 id=video1 width=356>
- <param name="_ExtentX" value="7276">
- <param name="_ExtentY" value="1058">
- <param name="AUTOSTART" value="0">
- <param name="SHUFFLE" value="0">
- <param name="PREFETCH" value="0">
- <param name="NOLABELS" value="0">
- <param name="CONTROLS" value="ControlPanel">
- <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="#ffffff">
- <embed type="audio/x-pn-realaudio-plugin" console="Clip1" controls="ControlPanel" height="27" width="356" autostart="0" _extentx="7276" _extenty="1058" shuffle="0" prefetch="0" nolabels="0" loop="0" numloop="0" center="0" maintainaspect="0" backgroundcolor="#ffffff">
- </embed>
- </object>
<object classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA height=27 id=video1 width=356>
<param name="_ExtentX" value="7276">
<param name="_ExtentY" value="1058">
<param name="AUTOSTART" value="0">
<param name="SHUFFLE" value="0">
<param name="PREFETCH" value="0">
<param name="NOLABELS" value="0">
<param name="CONTROLS" value="ControlPanel">
<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="#ffffff">
<embed type="audio/x-pn-realaudio-plugin" console="Clip1" controls="ControlPanel" height="27" width="356" autostart="0" _extentx="7276" _extenty="1058" shuffle="0" prefetch="0" nolabels="0" loop="0" numloop="0" center="0" maintainaspect="0" backgroundcolor="#ffffff">
</embed>
</object>
如何实现多媒体在线播放的功能
解决思路:
不同的媒体文件,都必须用相应的播放器播放,所以不同的媒体文件在线播放的代码也是不一样的。
具体步骤:
1.用RealPlay或RealOne播放的代码:
- <OBJECT classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" height="265" width="500">
- <PARAM NAME="_ExtentX" VALUE="10372">
- <PARAM NAME="_ExtentY" VALUE="6456">
- <PARAM NAME="SRC" VALUE="demo.rm">
- <PARAM NAME="AUTOSTART" VALUE="-1">
- <PARAM NAME="SHUFFLE" VALUE="0">
- <PARAM NAME="PREFETCH" VALUE="0">
- <PARAM NAME="NOLABELS" VALUE="0">
- <PARAM NAME="CONTROLS" VALUE="IMAGEWINDOW">
- <PARAM NAME="CONSOLE" VALUE="Clip528211525">
- <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 _extentx="10372" _extenty="6456" autostart="0" src="" shuffle="0" prefetch="0" nolabels="0" controls="IMAGEWINDOW" console="Clip528211525" loop="0" numloop="0" center="0" maintainaspect="0" backgroundcolor="#000000">
- </embed>
- </OBJECT>
<OBJECT classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" height="265" width="500">
<PARAM NAME="_ExtentX" VALUE="10372">
<PARAM NAME="_ExtentY" VALUE="6456">
<PARAM NAME="SRC" VALUE="demo.rm">
<PARAM NAME="AUTOSTART" VALUE="-1">
<PARAM NAME="SHUFFLE" VALUE="0">
<PARAM NAME="PREFETCH" VALUE="0">
<PARAM NAME="NOLABELS" VALUE="0">
<PARAM NAME="CONTROLS" VALUE="IMAGEWINDOW">
<PARAM NAME="CONSOLE" VALUE="Clip528211525">
<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 _extentx="10372" _extenty="6456" autostart="0" src="" shuffle="0" prefetch="0" nolabels="0" controls="IMAGEWINDOW" console="Clip528211525" loop="0" numloop="0" center="0" maintainaspect="0" backgroundcolor="#000000">
</embed>
</OBJECT>
运行效果:
图1.8.5 网页中调用RealOne播放器
要知道更多更详细的属性及控制方法,请参考:
http://service.real.com/help/library/guides/extend/embed.htm
2.用Windows Media Player。
- <object align="middle" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
- id="MediaPlayer" width="500" height="350">
- <param name="ShowStatusBar" value="-1">
- <param name="Filename" value="demo.asf">
- <embed type="application/x-oleobject" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" flename="mp" src="demo.asf" width=500 height=300></embed>
- </object>
<object align="middle" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
id="MediaPlayer" width="500" height="350">
<param name="ShowStatusBar" value="-1">
<param name="Filename" value="demo.asf">
<embed type="application/x-oleobject" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" flename="mp" src="demo.asf" width=500 height=300></embed>
</object>
运行效果:
图1.8.6网页中调用Media Player
要了解更多关于网页中的Media Player,请参考:
http://msdn.microsoft.com/library/en-us/dnwmt/html/adding_windows_media_to_web_pages__etse.asp?frame=true
http://msdn.microsoft.com/library/en-us/dnwmt/html/webdevtech.asp?frame=true
3. 用QuickTime播放。
- <object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0" width="500" height="350" align="middle">
- <param name="src" value="sample.mov">
- <param name="autoplay" value="true">
- <embed src="sample.mov" autoplay="true" width="500" height="350" align="middle" bgcolor="black" pluginspage="http://www.apple.com/quicktime/download/"></embed>
- </object>
<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0" width="500" height="350" align="middle">
<param name="src" value="sample.mov">
<param name="autoplay" value="true">
<embed src="sample.mov" autoplay="true" width="500" height="350" align="middle" bgcolor="black" pluginspage="http://www.apple.com/quicktime/download/"></embed>
</object>
代码运行效果:
图1.8.7 网页中调用QuickTime播放器
要知道更高级的用法及控制方法,请参考:
http://developer.apple.com/quicktime/quicktimeintro/tools/embed.html
http://developer.apple.com/quicktime/quicktimeintro/tools/embed2.html
http://developer.apple.com/internet/ieembedprep.html
http://developer.apple.com/quicktime/compatibility.html
http://developer.apple.com/documentation/QuickTime/QT6WhatsNew/Chap1/chapter_1_section_55.html
4.Shockwave。
- <object classid="clsid:166B1BCA-3F9C-11CF-8075-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=7,0,2,0" width="500" height="350">
- <param name="src" value="demo.swf">
- <embed src="demo.swf" pluginspage="http://www.macromedia.com/shockwave/download/" width="500" height="350"></embed>
- </object>
- 或者
- <object type="application/x-shockwave-flash"
- width="500" height="350" />
- <param name="movie" value="demo.swf" />
- </object>
<object classid="clsid:166B1BCA-3F9C-11CF-8075-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=7,0,2,0" width="500" height="350">
<param name="src" value="demo.swf">
<embed src="demo.swf" pluginspage="http://www.macromedia.com/shockwave/download/" width="500" height="350"></embed>
</object>
或者
<object type="application/x-shockwave-flash"
width="500" height="350" />
<param name="movie" value="demo.swf" />
</object>
代码运行效果:
图1.8.8 网页中调用Shockwave播放器
参考资料:
http://www.macromedia.com/devnet/mx/dreamweaver/articles/flash_satay.html
http://www.macromedia.com/devnet/activecontent/articles/devletter.html
http://www.macromedia.com/support/flash/ts/documents/java_script_comm.htm
http://www.macromedia.com/support/director/ts/documents/sw1parameter.htm
http://www.macromedia.com/support/director/internet/shockmachine_for_d8/shockmachine_for_d809.html
5.Flash。
- <OBJECT codeBase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="500"
- height="350">
- <PARAM NAME="movie" VALUE="demo.swf">
- <PARAM NAME="play" VALUE="false">
- <PARAM NAME="quality" VALUE="high">
- <embed src="demo.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="500" height="350"></embed>
- </OBJECT>
<OBJECT codeBase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="500"
height="350">
<PARAM NAME="movie" VALUE="demo.swf">
<PARAM NAME="play" VALUE="false">
<PARAM NAME="quality" VALUE="high">
<embed src="demo.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="500" height="350"></embed>
</OBJECT>