播放器js控制MediaPlayer

控制MediaPlayer播放器的例子:
[html]

播放控制:
音乐切换:




播放控制:




声道控制:





进度控制:






音量控制:









速度控制:





界面控制:
字幕控制:




音量控制:




播放控制:




媒体信息:




GotoBar :




状 态 栏:




跟 踪 条:




位置控制:




窗口缩放:




[/html]

RealPlayer网页播放器参数

参数: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 GetShowAbout: WordBool;
procedure SetShowAbout(bVal: WordBool);
function GetOriginalSize: WordBool;
procedure SetOriginalSize;
function GetDoubleSize: WordBool;
procedure SetDoubleSize;
function GetFullScreen: WordBool;
procedure SetFullScreen;
function GetEnableContextMenu: WordBool;
procedure SetEnableContextMenu(bVal: WordBool);
function GetEnableOriginalSize: WordBool;
procedure SetEnableOriginalSize(bVal: WordBool);
function GetEnableDoubleSize: WordBool;
procedure SetEnableDoubleSize(bVal: WordBool);
function GetEnableFullScreen: WordBool;
procedure SetEnableFullScreen(bVal: WordBool);
function GetEnableMessageBox: WordBool;
procedure SetEnableMessageBox(bVal: WordBool);
procedure SetTitle(const pVal: WideString);
procedure SetAuthor(const pVal: WideString);
procedure SetCopyright(const pVal: WideString);
function GetWantKeyboardEvents: WordBool;
procedure SetWantKeyboardEvents(bWantsEvents: WordBool);
function GetWantMouseEvents: WordBool;
procedure SetWantMouseEvents(bWantsEvents: WordBool);
function GetNumEntries: Smallint;
function GetCurrentEntry: Smallint;
function GetEntryTitle(uEntryIndex: Smallint): WideString;
function GetEntryAuthor(uEntryIndex: Smallint): WideString;
function GetEntryCopyright(uEntryIndex: Smallint): WideString;
function GetEntryAbstract(uEntryIndex: Smallint): WideString;
procedure SetCanSeek(bCanSeek: WordBool);
function GetCanSeek: WordBool;
function GetBufferingTimeElapsed: Integer;
function GetBufferingTimeRemaining: Integer;
function GetConnectionBandwidth: Integer;
function GetPreferedLanguageString: WideString;
function GetPreferedLanguageID: Integer;
function GetUserCountryID: Integer;
function GetNumSources: Smallint;
function GetSourceTransport(nSourceNum: Smallint): WideString;
function GetWantErrors: WordBool;
procedure SetWantErrors(bVal: WordBool);
function GetShuffle: WordBool;
procedure SetShuffle(bVal: WordBool);
function GetVersionInfo: WideString;
function GetLastMessage: WideString;
function GetLastErrorSeverity: Integer;
function GetLastErrorRMACode: Integer;
function GetLastErrorUserCode: Integer;
function GetLastErrorUserString: WideString;
function GetLastErrorMoreInfoURL: WideString;
procedure SetPreFetch(bVal: WordBool);
function GetPreFetch: WordBool;
procedure SetRegion(const pVal: WideString);
function GetRegion: WideString;
function GetIsPlus: WordBool;
function GetConsoleEvents: WordBool;
procedure SetConsoleEvents(bVal: WordBool);
function GetDRMInfo(const pVal: WideString): WideString;
property ControlInterface: IRealAudio read GetControlInterface;
property DefaultInterface: IRealAudio read GetControlInterface;

改一个PJBlog的错误

晚上闲着没事,在找这个Blog的漏洞,发现一个极其郁闷的低级问题,就是在翻页里,如果地址后面的页面参数不是数字,如:blog/default.asp?page=2a,就会出错了,const.asp这个页面报错。
赶紧修了先。
半分钟搞定。
修改代码如下:
找到报错那一行,即:
If IsInteger(Curpage)=False or Curpage<0 Then Curpage=1 改成: If IsInteger(Curpage)<>False Then
If Curpage<0 Then Curpage=1 Else Curpage=1 End If

Blog的修改

有时发现已经发表的文章需要修改,修改后会在文章下面出现一行:
[本日志由 Lee 于 2007-04-22 08:05 PM 编辑]
这样的文字。
我很不喜欢这个。看了下程序,把这个处理了下,改成系统管理员修改文章不出现这样的字样。方法如下:
在caheMod.asp及cls_logAction.asp文件里找到:
if len(log_View(“log_Modify”))>0 then
这一行,改成:
if len(log_View(“log_Modify”))>0 and stat_Admin=false then

如果你也用这个Blog程序,也有这样的想法。可以按此方法修改。

[ASP]一个用application存数组的例子

If you store an array in an Application object, you should not attempt to alter the elements of the stored array directly. For example, the following script does not work:
<%pplication("StoredArray")(3) = "new value"%>
This is because the Application object is implemented as a collection. The array element StoredArray(3) does not receive the new value. Instead, the value would be included in the Application object collection, and would overwrite any information that had previously been stored at that location. It is strongly recommended that if you store an array in the Application object, you retrieve a copy of the array before retrieving or changing any of the elements of the array. When you are done with the array, you should store the array in the Application object again, so that any changes you made are saved. This is demonstrated in the following scripts.
—file1.asp—
<%'Creating and initializing the array.
dim MyArray()
Redim MyArray(5)
MyArray(0) = "hello"
MyArray(1) = "some other string"
'Storing the array in the Application object.
Application.Lock
Application("StoredArray") = MyArray
Application.Unlock
Server.Transfer("file2.asp")
%>

—file2.asp—
 <%'Retrieving the array from the Application Object
'and modifying its second element.
LocalArray = Application("StoredArray")
LocalArray(1) = " there"
'Printing out the string "hello there."
Response.Write(LocalArray(0)&LocalArray(1))
'Re-storing the array in the Application object.
'This overwrites the values in StoredArray with the new values.
Application.Lock
Application("StoredArray") = LocalArray
Application.Unlock
%>

简单的下拉菜单

前几天要用到一个下拉菜单,就自己写了个。
虽不是好东西,也拿出来共享下,献丑了。
请多提意见。代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"  xml:lang="zh-CN" lang="zh-CN">
<head>
<script language="javascript">
function showMenu(n){
    var lis=document.getElementById('menus').getElementsByTagName('li');
    var num=lis.length;
    for(i=1;i<num+1;i++){
        document.getElementById('menu'+i).style.display='none';
    }
    document.getElementById('menu'+n).style.display='';
    for (i=0;i<lis.length;i++){
        lis[i].style.backgroundColor='';
    }
    lis[n-1].style.backgroundColor='#595757';

}</script>
<style type="text/css">
a.navs{width:50px; padding:0 5px 0 5px;}
a.navs:link,a.r:link{color:#FFFFFF;}
a.navs:visited,a.r:visited{color:#FFFFFF;}
a.navs:hover,a.r:hover{color:#FFFFFF; }
.Nav ul {
    padding: 0px;
    list-style-type: none;
    margin:0;
    background-color: #b93d47;
    width: 300px;
    height: 20px;
}
.Nav li {
    margin: 0px 1px 0px 0px;
    padding: 2px 9px 1px 9px;
    float: left;
    color: #FFFFFF;
    font-size: 15px;
    height: 17px;
}
.submenu a {
    padding:2px 8px 0px 13px;
    float: left; text-decoration:none;
}
.submenu a:hover,.submenu a:link,.submenu a:visited {
    color:#000000;
}
.submenu #menu2 {
    margin-left: 80px;
}
.submenu #menu3 {
    margin-left: 155px;
}

</style>
</head>
<body>
    <div class="Nav" id="menus"><ul>
      <li><a href="#" class="navs" onmouseover="showMenu(1)">Company</a></li>
      <li><a href="#" class="navs" onmouseover="showMenu(2)">Products</a></li>
      <li><a href="#" class="navs" onmouseover="showMenu(3)">Press</a></li>
      </ul>
    </div>
    <div class="submenu" id="submenus">
        <div id="menu1">
            <a href="#">Profile</a><a href="#">Mission</a></div>
        <div id="menu2" style="display:none">
            <a href="#">products1</a><a href="#">products2</a><a href="#">products3</a></div>
        <div id="menu3" style="display:none">
            <a href="#">News</a><a href="#">Events</a></div>
    </div>
</body>
</html>

关于iframe高度的自适应

这两天在帮朋友做一个站,因为页面中除了中间的内容不同,头部导航和底部内容都是一样的,所以我考虑用iframe来嵌入中间的内容,通过点击导航上的链接来改变其页面。

由于中间内容高度不一定,所以涉及到自动调整iframe高的问题。用document.body.scrollHeight可以取得本页面内容高,然后通过JS来改变iframe的高:

window.parent.document.getElementsByTagName('iframe')[0].style.height = document.body.scrollHeight

但是在IE中正常的代码,在FF中iframe的高不会变化,同时document.body.scrollHeight取得的值也比IE中的小。

后来经过多次实验我发现,FF中,长度属性要加单位,另外,由于我用Div+CSS来布局,有的容器没有写上高度,造成取得的页面内容高度偏低。知道了原因,解决起问题就快多了。

最终代码如下:

function   changeIframeHeight()  //自动改变 Iframe 的高度,加在Iframe页面的Onload
  {
 if (top != self)
  try
  {
   var h = document.body.scrollHeight;
   if(document.all) {h += 4;}
   if(window.opera) {h += 1;}
   var hpx = h+'px';
   window.parent.document.getElementsByTagName('iframe')[0].style.height = hpx;//我的页面中只一个嵌入
     }
  catch(e)
  {alert("脚本无法跨域操作!");}
  }

另外,由于我是用Div+CSS来布局的,所以要在iframe标签中加入以下代码,以防在FF中由于父标签的高不够而造成部分内容无法显示:
<div id="Content"><iframe src="profile.html" id="mainFrame" name="mainFrame" width="1000" frameborder="0" scrolling="auto" height="440" onload="changp(this);"></iframe></div>

changp()函数如下:

function changp(c){
 c.parentNode.style.height=c.style.height;
}

[PHP]plog0.3.2不支持php5的解决方法

没时间细看,不知道现在支持不了,反正先转了再说。

 

Plog0.32不支持php5,类定义出现问题……

还好以前有高人已经解决了,但是原文没有太弄明白,那个判断错误的程序function _internalErrorHandler( $e)老是出错,

说getfile()有问题,弄了半天不行只好屏蔽了,留了一个空函数在那里,竟然可以运行……也不知道会不会有问题。上SMTH找牛人请教去。

贴下那篇文章:

【原作:snowphy  @ SMTH

日前由于需要在php5上运行plog,但网上下载的plog_0.3.2_cn包不能直接使用(未汉化的没有看,应该也不行)
又找不到资料,只能自己研究,侥幸成功,不敢把经验独享,写个总结供其他有同样需要的人做参考。

以下步骤在windows2000 Advanced Server系统实现
使用plog_0.3.2_cn + php5.0.2 + mysql4.1.7(mysqli函数库)

修改plog_0.3.2_cn源程序如下
1.修改/class/object/exception.class.php:
说明:
去掉里面的Exception类,去掉throw、catch函数。修改_internalErrorHandler函数(名字无所谓,可以改成你喜欢的)
这里要说的是,php5提供了系统的Exception类,所以不用再自己定义,而且也不能自己定义,否则会出现重复定义的错误
这里提供的错误处理类,仅仅是打印出错误信息,高级功能请自行编写。
  //自定义错误处理函数
  /*
   *参数:$e   Exception类型
   */
  function _internalErrorHandler( $e)
  {
    echo ("Error in file " . $e->getFile( ) . " on line " .

       $e->getLine( ) . ".
" . "Error message: "" . $e->getMessage( ) .

       "" and error code: " . $e->getCode( ) . ".");
  }

  //注册我们自定义的错误处理函数
  $old_error_handler = set_error_handler( "_internalErrorHandler" );
?>

2.修改/class/object/reflection.class.php
reflection类改名为_reflection
说明:
同上,php5提供了Reflection类,这里我们把类名稍做变动
Reflection的具体作用请参考php5手册
由于其他代码里用到了自定义的这个类,我没有把它去掉

3./class/controller/controller.class.php
原new reflection()改为new _reflection()
说明:
此改动对应2

4./class/database/adodb/adodb-iterator.inc.php
ADODB_Iterator类增加函数
function valid()
{
  return !$this->rs->EOF;
}
说明:
实际上应该是把hasMore函数改名为valid,怕有其他代码对hasMore的调用,
就多加了一个,两个函数功能是一样的,这样调用哪一个都可以。

做了上述改动之后就可以把plog_0.3.2装在php5上了,下面的改动是为了让plog使用mysqli的函数库来代替原来的mysql函数库

5./class/database/db.class.php(line 24)
/class/dao/model.class.php(line 45)
/wizard.php(line 397 in function connectDb)
/register.php(line 52 in function connectDb)
/class/plugin/pluginbase.class.php(line 171 in function connectDb)
/class/config/configdbstorage.class.php(line 59 in function ConfigDbStorage)

就是把代码中所有 $db = NewADOConnection("mysql");的,都改成 $db = NewADOConnection("mysqli");
这个也可以改成其他你想用的数据库类型,plog支持的数据库种类还是蛮多的。

做完之后发现也没做多少改动,却花了不少时间-_-,想想主要是对php5不熟悉,准确的说是php5比php4多了哪些功能,
改动过程中,主要参考了O"Reilly出版的《Upgrading.to.PHP.5》,应该说学到了不少东西*^_^*

由于改动不多,就不提供改好的包了,有需要的按照上面的办法改以下还快就能搞定的。

希望能给正在找相关资料的人提供帮助。
                                                                                                                                          2004-11-18
                                                                                                                                               snowphy
附:
Upgrading to PHP 5
By Adam Trachtenberg

Publisher : O"Reilly
Pub Date : July 2004
ISBN : 0-596-00636-5
Pages : 304