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

我们经常要在网页中插入各种在线视频格式的播放器,可以让用户访问的时候直接欣赏视频,这里收集整理了大部分的视频格式播放代码。

1.avi格式

代码片断如下:



2.mpg格式

代码片断如下:


3.smi格式

代码片断如下:


4.rm格式

代码片断如下:


5.wmv格式

代码片断如下:


6.wma格式

放在 里面。下面是部分解释:


7.Windows Media Player 系列(不同面板样式)

综合型:


简易型:



标签型:

引用内容

媒体播放器的外观界面

在网页中,你可以通过相关属性来控制媒体播放器的哪些部分出现,哪些部分不出现。
媒体播放器包括如下元素:
Video Display Panel:视频显示面板;
Video Border:视频边框;
Closed Captioning Display Panel;字幕显示面板;
Track Bar;搜索栏;
Control Bar with Audio and Position Controls:带有声音和位置控制的控制栏;
Go To Bar:转到栏;
Display Panel:显示面板;
Status Bar:状态栏;
下面的属性用来决定显示哪一个元素:
ShowControls 属性:是否显示控制栏(包括播放控件及可选的声音和位置控件);
ShowAudioControls 属性:是否在控制栏显示声音控件(静音按钮和音量滑块);
ShowPositionControls 属性:是否在控制栏显示位置控件(包括向后跳进、快退、快进、向前跳进、预览播放列表中的每个剪辑);
ShowTracker 属性:是否显示搜索栏;
ShowDisplay 属性:是否显示显示面板(用来提供节目与剪辑的信息);
ShowCaptioning 属性:是否显示字幕显示面板;
ShowGotoBar 属性:是否显示转到栏;
ShowStatusBar 属性:是否显示状态栏;

播放列表

媒体播放器提供下面的方法来访问播放列表中的剪辑:
Next 方法,跳到节目(播放列表)中的下一个剪辑;
Previous 方法,跳回到节目中的上一个剪辑;
媒体播放器的一个特性是能够预览节目中的每一个剪辑,使用如下属性:
PreviewMode 属性,决定媒体播放器当前是否处于预览模式;
CanPreview 属性,决定媒体播放器能否处于预览模式;
在windows 媒体元文件中,可以为每一个剪辑指定预览时间——PREVIEWDURATION,如果没有指定,那么默认的预览时间是10秒钟。
你也可以用Windows 媒体元文件来添加 watermarks 与 banners,元文件也支持插入广告时的无间隙流切换。

节目信息

使用 GetMediaInfoString 方法可以返回相关剪辑或节目的如下信息:
文件名:File name
标题:Title
描述:Description
作者:Author
版权:Copyright
级别:Rating
URLs:logo icon、watermark、banner的地址
剪辑信息可以放在媒体文件中,也可以放在Windows 媒体元文件中,或者两者都放。如果在元文件中指定了剪辑信息,那么用 GetMediaInfoString 方法返回的就是元文件中的信息,而不会返回剪辑中包含的信息。
在元文件中,附加信息可以放置在每一个剪辑或节目的 PARAM标签中。你可以为每个剪辑添加任意多个 PARAM 标签,用来存储自定义的信息或链接到相关站点。在 PARAM 标签中的信息可以通过 GetMediaParameter 方法来访问。
下面的属性返回有关大小和时间的信息:
ImageSourceHeight、ImageSourceWidth:返回图像窗口的显示尺寸;
Duration 属性,返回剪辑的长度(秒), 要检测这个属性是否包含有效的数值,请检查IsDurationValid 属性。(对于广播的视频,其长度是不可预知的)。

字幕

你可以用 .smi 文件来为你的节目添加字幕。媒体播放器支持下面的属性来处理字幕:
SAMIFileName 属性,指定 .smi 文件的名字;
SAMILang 属性,指定字幕的语言(如果没有指定则使用第一种语言);
SAMIStyle 属性,指定字幕的文字大小和样式;
ShowCaptioning 属性,决定是否显示字幕显示面板;

脚本命令

伴随音频、视频流,你可以在流媒体文件中加入脚本命令。脚本命令是多媒体流中与特定时间同步的多对Unicode串。第一个串标识待发命令的类型,第二个串指定要执行的命令。
当流播放到与脚本相关的时间时,控件会向网页发送一个 ScriptCommand事件,然后由事件处理进程来响应这个事件。脚本命令字符串会作为脚本命令事件的参数传递给事件处理器。
媒体播放器会自动处理下面类型的内嵌脚本命令:
1) URL型命令:当媒体播放器控件收到一个URL型的命令时,指定的URL会被装载到用户的默认浏览器。如果媒体播放器嵌在一个分帧的HTML文件中,URL页可以装载到由脚本命令指定的帧内。如果脚本命令没有指定一个帧,将由 DefaultFrame 属性决定将 URL 页装入哪一帧。
你可以通过设置 InvokeURLs 属性来决定是否自动处理 URL 型的脚本命令。如果这个属性的值为 false ,媒体播放器控件将忽视 URL型命令。但是脚本命令事件仍会触发,这就允许你有选择地处理 URL 型命令。
URL 型命令指定的是 URL 的相对地址。基地址是由 BaseURL属性指定的。媒体播放器控件传送的脚本命令事件的命令参数是链接好的地址。
2) FILENAME型命令:当媒体播放器控件收到一个FILENAME型的命令时,它将 FileName属性设置为脚本命令提供的文件,之后媒体播放器会打开这个文件开始播放。 媒体播放器控件总是自动处理 FILENAME 型命令,不象 URL 型命令,它们不能被禁止。
3) TEXT型命令:当媒体播放器控件收到一个 TEXT型的命令时,它会将命令的内容显示在控件的字幕窗口。内容可以是纯文本的,也可以是 HTML。
4) EVENT型命令:当媒体播放器控件收到一个 EVENT型的命令时,它会在媒体元文件中搜索 EVENT 元素的 NAME 属性。如果 NAME 属性与脚本命令中的第二个字符串匹配,媒体播放器控件就执行包含在 EVENT 元素中的条目。
5) OPENEVENT型命令:当媒体播放器控件收到一个 OPENEVENT型的命令时,它会在媒体元文件中检查 EVENT 元素,并打开匹配的标题,但不播放,直到收到来自 EVENT型命令的同名真实事件。

捕捉键盘和鼠标事件

EnableContextMenu 与 ClickToPlay 属性为用户提供了在图像窗口进行操作的方法。
如果 EnableContextMenu 属性为 true ,在图像窗口右击鼠标可以打开关联菜单,如果将ClickToPlay 属性设为 true ,用户可以单击图像窗口进行播放与暂停的切换。
要接收鼠标移动和单击事件,请将 SendMouseMoveEvents 和 SendMouseClickEvents 属性设为 true 。鼠标事件有:
MouseDown,当用户按下鼠标时产生;
MouseUp,当用户释放鼠标时产生;
MouseMove,当用户移动鼠标时产生;
Click,当用户在媒体播放器上单击鼠标按钮时产生;
DbClick,当用户在媒体播放器上双击鼠标按钮时产生;
要接收键盘事件,请将 SendKeyboardEvents 属性设为 true 。键盘事件有:
KeyDown,当用户按下一个键时产生;
KeyUp,当用户释放一个键时产生;
KeyPress,当用户按下并释放一个键时产生;

监测流状态与网络链接

流状态属性包括:
PlayState:播放状态;
OpenState:打开状态;
Bandwidth:带宽;
支持的事件有:
OpenStateChange:打开状态改变(仅当SendOpenStateChangeEvents属性为true时触发)
PlayStateChange:播放状态改变(仅当SendPlayStateChangeEvents属性为true时触发)
EndOfStream:流结束时触发;
NewStream:打开新流时触发;
网络接收属性包括:
ReceptionQuality:接收质量;
ReceivedPackets:已经收到的包;
LostPackets:丢失的包;
监测缓冲的属性有:
BufferingTime:缓冲时间;
BufferingCount:缓冲次数;
BufferingProgress:缓冲进程;
Buffering:缓冲事件;

错误处理

媒体播放器提供了内建的错误处理功能——在对话框或状态栏显示错误信息。 另外,你可以自己添加错误处理程序。如果 SendErrorEvents 属性设置为 true,将不会显示错误框,而是发送错误事件;如果 SendErrorEvents 属性设置为 false,将显示错误框,而是发送错误事件。
媒体播放器支持下面的错误处理事件:
Error 事件,指有危险性错误发生;
Warning 事件,指发生了非危险性的错误;
当你的应用程序接收到一个错误事件,你可以检测下面的属性来确定具体的错误信息:
HasError:检测目前的媒体播放器是否有错误;
ErrorCode:提供与该类型错误相关的代码值;
ErrorDescription:提供错误的描述信息;
ErrorCorrection:指定媒体播放器对该类型的错误进行校正;

播放CD

媒体播放器将 CD 看作(在每个音轨的开头具有标记的)单一音频流。 要在网页中使用CD,你需要将 FileName 属性设为 CDAUDI,必须带有冒号,如下所示:


CD Audio Playback Example











之后你可以用 Play 方法播放 CD 了。
你可以在 windows 媒体元文件中指定播放顺序以及每个音轨的信息。示例如下:



CD Audio with the Media Player
Windows Media Technologies
(c) 1999, Microsoft, Inc.


Track 1: Title 1




Track 2: Title 2




Track 3: Title 3




Track 4: Title 4




参考资料来源:CSDN

0 thoughts on “网页中插入视频播放代码全集”

  1. I do love the way you have presented this challenge plus it really does offer me personally some fodder for consideration.
    However, from what precisely I have experienced, I simply hope
    as other reviews pile on that people continue to be on issue and don’t get started on a
    tirade of the news du jour. Anyway, thank you for this outstanding piece and although
    I do not really go along with it in totality, I regard the standpoint.

  2. 大量在庫超人気の新しい2018年!
    ☆――☆ブランドバッグ☆――☆
    ☆――☆ブランド服コピー☆――☆
    ☆――☆ブランド靴コピー ☆――☆
    ※―――※―――※―――※―――※
    ルイヴィトン靴コピー,エレメス靴
    ルブタン コピー,シャネル靴コピー
    バーバリー靴コピー,クロムハーツ靴
    ※―――※―――※―――※―――※
    ①高品質、特恵価格、実物写真、納期厳守。
    ②お客様の満足することは 弊社の責任です。
    それでは不良品物情況、無償で交換します。
    ③配送方法 : 全物品運賃無料(日本全国)
    ※―――※―――※―――※―――※
    営業時間:24時間、年中無休
    オンライン連絡時間:平日8時から18時まで
    ☆――☆――☆――☆――☆――☆

  3. Good day I am so delighted I found your blog page, I really found you by accident,
    while I was searching on Askjeeve for something else, Anyways
    I am here now and would just like to say cheers for a marvelous
    post and a all round entertaining blog (I also love the theme/design), I don’t have
    time to look over it all at the moment but I have book-marked it and
    also added your RSS feeds, so when I have time I will
    be back to read a great deal more, Please do keep
    up the great job.

  4. Hey! Would you mind if I share your blog with my myspace group?
    There’s a lot of folks that I think would really appreciate your content.

    Please let me know. Thanks

  5. スーパーコピー豊富に揃えております、最も手頃ず価格だお気に入りの商品を購入。
    弊店はロレックスコピー、パネライスーパーコピー、ウブロ時計スーパーコピー、IWC時計コピー、ブライトリングコピー等を販売しているコピー時計屋です。
    ロレックススーパーコピーを主に世界一流のブランドスーパーコピー時計を取り扱っています。
    2018年最新スタイルの長財布で、品質もいいです。
    このサイトをご覧ください
    スーパーコピー 販売店舗 https://www.copysale.net/Copy-sale-6252-_25E3_2582_25AA_25E3_2583_25A1_25E3_2582_25AC-_25E3_2582_25B3_25E3_2583_25B3_25E3_2580B19BD6CB1.htm

  6. オンラインショッピングは最低価格になる
    人気新作、全国送料無料!
    デザイナー高級アイテムであなたの完璧新品、激安販売!
    本物
    2018新しいスタイルの高級アイテムは、オンラインアウトレット
    【激安保証】
    クリスマス大り出し!
    高品質、信用第一そして低価格!
    セール(SALE)限定セール限定セール!
    限定セールキャンペーン限定セール!
    私たちは、お客様が本物の提供
    最も安い贅沢品を購入するチャンスをお見逃しなく!
    大幅割引で本物を販売中!
    高級品オンラインストアで
    当社は、最高品質を提供しています

  7. コピー業界取扱ブランド腕時計最大級激安通販!
    ルイヴィトンバッグ、エルメスコピー、腕時計ブランドコピー 時計ブランドコピー 腕時計コピー コピー時計 通販は腕時計ブランドコピーN品専売店です。
    最高品質のブランドコピー腕時計を取扱っています。
    ブランドコピーバッグ、など全て新品商品になります。
    ★迅速、確実にお客様の手元にお届け致します。
    ★実物写真、付属品を完備しております。
    ★低価格を提供すると共に、品質を絶対保証しております。
    ★商品の交換と返品ができます。
    ブランドコピーバッグの誠実と信用の店、
    24時間以内に出荷し、3~4日に到着して、

  8. Pingback: Poker
  9. Just want to say your article is as astonishing. The clarity in your post is simply spectacular and i can assume you’re an expert on this subject.

    Fine with your permission allow me to grab your feed to
    keep updated with forthcoming post. Thanks a million and please keep up the gratifying work.

  10. Magnificent goods from you, man. I’ve understand your stuff previous to and you are
    just too fantastic. I actually like what you have
    acquired here, really like what you’re saying and the way
    in which you say it. You make it entertaining and you still
    take care of to keep it wise. I cant wait to read far
    more from you. This is actually a wonderful website.

  11. I am curiuous to find out ԝhat blog system you happen to be
    using? I’m experiencing some small security prfoblems with my latest blog and I’d likke to find
    something more safe. Do you have any recommendations?

  12. Itss such as you read my thoughts! Yߋu seem to understand a lot aрproximately this,
    like you wrote the ebook in it or something.
    I feel that you simply could do with a few p.c.
    to force the message homе a little bit, һowever other than that, that is mаgnificent blog.
    A fantastic read. I will definitely be back.

  13. Grewt bⅼog! Do you have any һints for aspiring writers?
    I’m hoping to start my own site ѕoon but I’m a little lost on everʏthing.
    Would you suggest starting with a free platform likе
    Wordpress or go for a paid option? Thеre are ssօ
    many choicdes out there that I’m comρletely overwhelmed ..Any tips?
    Thanks!

  14. I loved as much aaѕ уou will receive carriеd out right here.
    The sketcһ is attractiѵe, your authоred material stylish.
    nonetheless, you command get gott an shakiness over that you wish bee delivering the following.
    unwell unqueѕtionablʏ c᧐me fuгther formerly aɡain as
    exactly the ɑme nearly a lot often inside case you ѕhield tgis һike.

  15. After going over a number of the articles on your website, I truly appreciate your way of writing
    a blog. I book marked it to my bookmark webpage list and will be checking back soon. Take a look at my website too and let me know how you feel.

  16. I wanted to draft you the very small remark just to thank you so
    much the moment again with the spectacular solutions you have provided on this
    website. It’s really pretty open-handed of people like you to provide freely what exactly most
    of us might have made available for an e book to help make some profit for themselves,
    primarily now that you could possibly have tried it if you desired.
    These pointers as well acted to provide a easy way to recognize that other people have the identical keenness the same as my
    personal own to know very much more related
    to this issue. I know there are millions of more pleasurable situations
    ahead for people who look into your blog post.

  17. Attractive component to content. I simply stumbled upon your blog and in accession capital to say that I get actually loved account your blog posts.

    Any way I’ll be subscribing to your feeds or even I fulfillment you get admission to
    consistently fast.

  18. We would like to thank you just as before for the
    stunning ideas you offered Jesse when preparing her own post-graduate research
    and also, most importantly, pertaining to providing the
    many ideas in a blog post. If we had known of your website a year ago,
    i’d have been rescued from the useless measures
    we were implementing. Thanks to you.

  19. Wonderful website you have here but I was wondering if you knew of any user discussion forums that cover the same
    topics discussed in this article? I’d really like to be a part of group where I
    can get suggestions from other experienced people that share
    the same interest. If you have any suggestions, please let me know.
    Appreciate it!

  20. May I simply just say what a comfort to uncover somebody
    that actually knows what they’re talking about over the
    internet. You definitely know how to bring a problem to light and make it important.

    More and more people have to look at this and understand this
    side of the story. It’s surprising you’re not more popular given that you certainly have the gift.

  21. Woah! I’m really digging the template/theme of
    this website. It’s simple, yet effective.
    A lot of times it’s difficult to get that “perfect balance” between user friendliness and
    appearance. I must say that you’ve done a amazing job with this.
    Additionally, the blog loads very quick for me on Chrome.

    Exceptional Blog!

  22. Pingback: 腕時計コピー
  23. I’m amazed, I have to admit. Seldom do I encounter a blog that’s both
    equally educative and interesting, and without a doubt, you’ve hit the nail on the
    head. The problem is something not enough folks are speaking intelligently about.
    I’m very happy I stumbled across this in my search for
    something relating to this.

  24. Magnificent items from you, man. I’ve keep in mind
    your stuff previous to and you’re just extremely fantastic.
    I actually like what you have received right here, really like what you are saying and the way through which
    you are saying it. You are making it entertaining and you still take care of to keep it sensible.

    I cant wait to read far more from you. That is really
    a terrific web site.

  25. Good day I am so thrilled I found your website,
    I really found you by accident, while I was searching on Bing for something else, Anyways I am here now and would just like to say kudos for a tremendous post and a all round thrilling
    blog (I also love the theme/design), I don’t have time to read it all
    at the minute but I have saved it and also included your RSS feeds,
    so when I have time I will be back to read a lot more, Please do keep up the superb job.

  26. Greetings from Colorado! I’m bored at work so I
    decided to check out your website on my iphone during lunch break.
    I love the knowledge you present here and can’t wait
    to take a look when I get home. I’m shocked at how quick your blog loaded on my mobile ..
    I’m not even using WIFI, just 3G .. Anyhow, very good site!

  27. Hello there, just became alert to your blog through Google, and found that it is really informative.
    I am gonna watch out for brussels. I’ll be grateful if you continue this
    in future. Lots of people will be benefited from your writing.
    Cheers!

Leave a Reply

Your email address will not be published. Required fields are marked *

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Anti-spam image