找回密码
 注册
搜索
热搜: 回贴

为网页加播放器实现在线播放的代码实例

2009-12-16 02:44| 发布者: admin| 查看: 46| 评论: 0|原作者: 夙瑶

  我们在网页上看到的播放器无外乎WMP/RealOne/Macromedia Flash Player,其他的无非是面板不同,或者添加了其他控件,对于计算机上安装的一些播放器也都是编码和解码器的整合,其最核心的编码和解码技术是相同的。例如:网络上最流行的windows media流(asf,wma,wmv格式...),Real流(rm,rmvb...),还有MPEG系列编码格式(MP4/MP3格式...)
  Windows Media Video 是微软推出的一种流媒体格式,它是在“同门”的ASF(Advanced Stream Format)格式升级延伸来得.在同等视频质量下,WMV格式的体积非常小,因此很适合在网上播放和传输。Windows Media Player9兼容所有格式的WMV,官方编码器是Windows Media Encoder ,但是如果你想转制 高质量的wmv文件,那您一定要有超大的内存来处理数据...
  无意中发现CASTPOST的播放器可以自己定义大小,对于WMV格式的在线播放可以说已经足够快了,然后就费了好大劲把一些精彩的短片和一些经典的MTV转化WMV格式放了上来,尽管现在不能下载了,但是只要不是连接人数过多,播放起来还是很流畅的^_^
  WMP加入了ActiveX解码器控件,不仅可以放曲子,还能放Flash和其它视频文件
  





  想用WMP连续播放请参照ASX元文件使用讲解:使用ASX播放列表吧
  上面的这个播放器是老式的那种,6.4版本!新式播放器是在MediaPlayer9.0以后出现的,也就是说只有装了9.0或9.0以上的播放器才能正常使用的。
  -------------------------------------------------------------------
  下面是新式播放器代码,相对以前的来说要简单很多:
  













































  ----------------------------------------------------------------
  RealOne播放器代码:
  































  ------------------------------------------------------------------
  看着很多很复杂的样子,其实就是多了些播放器参数,可以不要...
  Real Player 网页播放器 参数含义
  参数:autostart 属性:True或是False 作用:指定是否自动播放指定的源文件
  参数:backgroundcolor 属性:任何用符号“#”开头的16进制数值或是任何预定义的颜色作用:指定图像窗口的背景颜色
  参数:center 属性:True或是False 作用:指定片断使用初始编码大小播放,并且在图像窗口的中央。
  参数:classid 属性:"clsid:CFCDAA03-8BE4-1lcf-B84B0020AFBBCCFA:** 作用:用于指定ActiveX控件的唯一的字符串标示,可以认出嵌入的RealPalyer播放器。
  参数:console 属性:任何字符串作用:可以将各种不同的RealPlayer控制聚集在网页上,这样它们可以交互使用或是保持独立,而且互相不影响
  参数:controls 属性:ImageWindow,All,ControlPanel,PlavButton,PlayOnlyButton, PauseButton,StopButton,FFCtrl,RWCtrl,MuteCtrl,MuteVolume,VolumeSlider,PositionSlider,TACCtrl,HomeCtrl,InfoVolumePanel,InfoPanel,StatusBar,StatusField,PositionField 作用:可以让你指定那些控制是可见的。
  参数:height 属性:任何整数值作用:指定RealPlayer元素的高度,单位:像素
  参数:id 属性:任何字符串作用:为标签中的RealPlayer元素指定名字。
  参数:imagestatus 属性:True或是False 作用:指定是否在图像窗口中显示状态信息,默认值是true
  参数:loop 属性:True或是False 作用:可以让你指定片断是否无限循环
  参数:maintainaspect 属性:True或是False 作用:默认RealPlayer拉伸所有的片断来充满整个图像窗口。
  参数:name 属性:任何字符串作用:为标签中的RealPlayer元素指定名字(在标签中使用id)
  参数:nojava 属性:True或是False 作用:避免启动Java虚拟机
  参数:nolabels 属性:True或是False 作用:可以禁止显示标题或是版权信息(realplayer5.0以上时,它是垃圾...)
  参数:nologo 属性:True或是False 作用:避免RealPlayer启动时在图像窗口中显示
  参数:numloop 属性:任何整数值作用:让你能够指定文件片循环的次数,不需要参数loop
  参数:prefetch 属性:True或是False 作用:指定在播放前,RealPlayer是否可以获得流描述信息,默认值是False
  参数:region 属性:任何字符串作用:同SMIL一起使用。允许你指定使用HTML代替SMIL
  参数:scriptcallbacks 属性:用逗号分割的列表作用:指定浏览器的回调监控(好高级的东东!)
  参数:shuffle 属性:True或是False 作用:同多文件片的ram文件或是SMIL文件一起使用。可以让RealPlayer随机播放列表中的文件
  参数:src 属性:任何合法的相对或是完整的URL 作用:指定播放的文件或是源文件的地址
  参数:type 属性:字符串作用:为嵌入插件指定MIME类型
  参数:width 属性:任何整数值作用:指定RealPlayer元素的宽度
  RealPlayer的一些函数、方法和过程
  这是 Real Player ActiveX Control Library (Version 1.0) 的所有函数与方法,有兴趣可以研究一下。
  function GetSource: WideString;
  procedure SetSource(const lpszNewValue: WideString);
  function GetConsole: WideString;
  procedure SetConsole(const lpszNewValue: WideString);
  function GetControls: WideString;
  procedure SetControls(const lpszNewValue: WideString);
  function GetNoLabels: WordBool;
  procedure SetNoLabels(bNewValue: WordBool);
  function GetAutoStart: WordBool;
  procedure SetAutoStart(bNewValue: WordBool);
  function GetAutoGotoURL: WordBool;
  procedure SetAutoGotoURL(bNewValue: WordBool);
  function GetVolume: Smallint;
  procedure SetVolume(nVol: Smallint);
  function GetMute: WordBool;
  procedure SetMute(bMute: WordBool);
  function GetLoop: WordBool;
  procedure SetLoop(bVal: WordBool);
  function GetImageStatus: WordBool;
  procedure SetImageStatus(bEnable: WordBool);
  function GetPacketsTotal: Integer;
  function GetPacketsReceived: Integer;
  function GetPacketsOutOfOrder: Integer;
  function GetPacketsMissing: Integer;
  function GetPacketsEarly: Integer;
  function GetPacketsLate: Integer;
  function GetBandwidthAverage: Integer;
  function GetBandwidthCurrent: Integer;
  procedure DoPlayPause;
  procedure DoStop;
  procedure DoNextItem;
  procedure DoPrevItem;
  function CanPlayPause: WordBool;
  function CanStop: WordBool;
  function HasNextItem: WordBool;
  function HasPrevItem: WordBool;
  function HasNextEntry: WordBool;
  function HasPrevEntry: WordBool;
  procedure DoNextEntry;
  procedure DoPrevEntry;
  procedure AboutBox;
  procedure EditPreferences;
  procedure HideShowStatistics;
  function IsStatisticsVisible: WordBool;
  procedure DoGotoURL(const url: WideString; const target: WideString);
  procedure DoPlay;
  procedure DoPause;
  function GetPosition: Integer;
  function GetPlayState: Integer;
  function GetLength: Integer;
  function GetTitle: WideString;
  function GetAuthor: WideString;
  function GetCopyright: WideString;
  function GetClipWidth: Integer;
  function GetClipHeight: Integer;
  function CanPlay: WordBool;
  function CanPause: WordBool;
  procedure SetPosition(lPosition: Integer);
  function GetNumLoop: Integer;
  procedure SetNumLoop(lVal: Integer);
  function GetCenter: WordBool;
  procedure SetCenter(bVal: WordBool);
  function GetNoLogo: WordBool;
  procedure SetNoLogo(bVal: WordBool);
  function GetMaintainAspect: WordBool;
  procedure SetMaintainAspect(bVal: WordBool);
  function GetBackgroundColor: WideString;
  procedure SetBackgroundColor(const pVal: WideString);
  function GetStereoState: WordBool;
  function GetLiveState: WordBool;
  function GetShowStatistics: WordBool;
  procedure SetShowStatistics(bVal: WordBool);
  function GetShowPreferences: WordBool;
  procedure SetShowPreferences(bVal: WordBool);
  function GetShowonmouseover WordBool;
  procedure SetShowAbou

最新评论

QQ|小黑屋|最新主题|手机版|微赢网络技术论坛 ( 苏ICP备08020429号 )

GMT+8, 2024-9-30 09:35 , Processed in 0.185542 second(s), 12 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

返回顶部