这是 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;
一个real例程
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0042)http://www.10010.com/wangyetexiao/17/8.htm -->
<!-- saved from url=(0056)http://www.baron.com.cn/javascript/zh/20030415music2.htm --><HTML><HEAD><TITLE>基本Real播放器</TITLE>
<STYLE type=text/css>BODY {
MARGIN-TOP: 0px; FONT-SIZE: 9pt; MARGIN-LEFT: 0px; MARGIN-RIGHT: 0px; FONT-FAMILY: "宋体"
}
A {
FONT-WEIGHT: 400; FONT-SIZE: 9pt; COLOR: black; TEXT-DECORATION: none
}
A:hover {
FONT-WEIGHT: 400; FONT-SIZE: 9pt; COLOR: red; TEXT-DECORATION: underline
}
A:active {
FONT: 9pt "宋体"; CURSOR: hand; COLOR: #ff0033
}
</STYLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 5.50.4522.1800" name=GENERATOR></HEAD>
<BODY bgColor=#fef4d9><BR><BR>
<CENTER><FONT face=隶书 color=red size=6>基本Real播放器</FONT></CENTER><BR>
<CENTER>
<TABLE borderColor=blue border=5 borderlight="green">
<TBODY>
<TR>
<TD align=middle><FONT face="Arial, Helvetica, sans-serif" color=red
size=3><STRONG>下面为效果显示</STRONG></FONT></TD></TR>
<TR>
<TD align=middle>
<SCRIPT>
//---------这是区分播放器的音乐类型,你可以填加修改------//
var RS = new Array("rm","ram","mp3","ra","rt","rp","rmm","png","m3u","mp2","mpa");
//-----------播放器状态-------------//
var Rstate = new Array("停止","连接","缓冲","播放","暂停");
var player_doing = false;
function choose_player(sound_path)
{
sound_path = sound_path.split(".");
var sound_type = sound_path[sound_path.length-1].toLowerCase();
for(i=0;i<RS.length;i++)
{
if(sound_type==RS)
return "R"
}
return "U";
}
function Do_play()
{
var the_player = document.getElementById("player");
the_player.DoPlay();
}
function Do_pause()
{
var the_player = document.getElementById("player");
the_player.DoPause();
}
function Do_stop()
{
var the_player = document.getElementById("player");
the_player.DoStop();
}
function Set_position(num)
{
var the_player = document.getElementById("player");
the_player.SetPosition(num);
}
function Get_position()
{
var the_player = document.getElementById("player");
return the_player.GetPosition();
}
function Get_length()
{
var the_player = document.getElementById("player");
return the_player.GetLength();
}
function Set_volume(num)
{
var the_player = document.getElementById("player");
the_player.SetVolume(num);
}
function Show_time(num)
{
var time_minute = Math.floor( num / 60000 );
var time_second = Math.floor( ( num - time_minute*60000 ) / 1000 );
if( time_minute < 10 )
time_minute = "0" + time_minute;
if( time_second < 10 )
time_second = "0" + time_second;
return (time_minute + ":" +time_second);
}
function Get_state()
{
var the_player = document.getElementById("player");
return the_player.GetPlayState();
}
function player_play()
{
var just_type = choose_player(document.getElementById("sound_path").value);
var the_player = document.getElementById("player");
var the_state = Get_state();
if(the_state==1||the_state==2||the_state==3)
{
return;
}
if(the_state==4)
{
Do_play();
}
if(the_state==0)
{
if(just_type=="R")
{
Do_stop();
the_player.SetSource(document.getElementById("sound_path").value);
Do_play();
if(player_doing)
{
clearInterval(player_doing)
}
player_doing = setInterval("Set_all()",500);
}
}
}
function Set_all()
{
var the_player = document.getElementById("player");
document.getElementById("position_box").value = Show_time(Get_position());
document.getElementById("length_box").value = Show_time(Get_length());
document.getElementById("state_box").value = Rstate[Get_state()];
var the_max = (document.getElementById("position_button_box").offsetWidth - document.getElementById("position_button").offsetWidth);
document.getElementById("position_button").style.pixelLeft = Math.round(the_max*Get_position()/Get_length());
if(Get_state()==0)
{
clearInterval(player_doing);
}
}
function Go_direction(num)
{
var the_player = document.getElementById("player");
var the_state = Get_state();
if(the_state==3)
{
var the_direction = num*1000;
var judger = (Get_position() + the_direction)
if(judger>=0&&judger<=Get_length())
{
Set_position(judger);
}
}
}
var Ox,Nx;
var move_obj_can_move = false;
var move_obj = false;
function start_move()
{
move_obj_can_move = true;
move_obj = event.srcElement.id;
document.getElementById(move_obj).setCapture();
Ox = event.clientX;
}
function document.onmouseup()
{
if(!move_obj)
return;
document.getElementById(move_obj).releaseCapture();
move_obj_can_move = false;
move_obj = false;
}
function document.onmousemove()
{
if(!document.getElementById(move_obj))
{
return;
}
if(move_obj=="position_button"&&Get_state()!=3)
{
return;
}
Nx = event.clientX;
var judger = document.getElementById(move_obj).style.pixelLeft + Nx - Ox;
var max = document.getElementById(move_obj+"_box").offsetWidth - document.getElementById(move_obj).offsetWidth;
if(!move_obj_can_move||!move_obj||judger>max||judger<0)
{
return;
}
document.getElementById(move_obj).style.pixelLeft += Nx - Ox;
eval(move_obj+"_event("+document.getElementById(move_obj).style.pixelLeft+","+max+")");
Ox = Nx;
}
function volume_button_event(s_num,b_num)
{
var judger = Math.round(100*s_num/b_num)
if(judger>=0&&judger<=100)
{
Set_volume(judger)
}
}
function position_button_event(s_num,b_num)
{
var judger = Math.round(Get_length()*s_num/b_num);
if(judger>=0||judger<=Get_length())
{
Set_position(judger)
}
}
</SCRIPT>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD width="37%"><EMBED id=player
src=///d:/My%20Documents/My%20Webs/ling.mp3 width=273 height=183
type=audio/x-pn-realaudio-plugin
controls="ImageWindow,ControlPanel"> </TD>
<TD vAlign=top width="63%"><INPUT onclick=player_play() type=button value=播放> <INPUT onclick=Do_pause() type=button value=暂停> <INPUT onclick=Do_stop() type=button value=停止> <INPUT onmousedown=Go_direction(-1) type=button value="<<<"> <INPUT onmousedown=Go_direction(1) type=button value=">>>">
<P><INPUT id=sound_path style="WIDTH: 163px; HEIGHT: 23px"
type=file> STATE:<INPUT id=state_box size=10> </P>
<P>POSITION: <INPUT id=position_box size=10> LENGTH: <INPUT
id=length_box size=11> </P>
<DIV align=left>
<TABLE cellSpacing=0 cellPadding=0 width="67%" border=0>
<TBODY>
<TR>
<TD id=volume_button_box width="100%" bgColor=#c0c0c0><INPUT onmousedown=start_move() id=volume_button style="LEFT: 100px; WIDTH: 32px; POSITION: relative; HEIGHT: 18px" type=button value=音量>
</TD></TR></TBODY></TABLE></DIV>
<P>
<DIV align=left>
<TABLE cellSpacing=0 cellPadding=0 width="67%" border=0>
<TBODY>
<TR>
<TD id=position_button_box width="100%" bgColor=#c0c0c0><INPUT onmousedown=start_move() id=position_button style="LEFT: 0px; WIDTH: 32px; POSITION: relative; HEIGHT: 18px" type=button value=NOW>
</TD></TR></TBODY></TABLE></DIV></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></CENTER><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<CENTER><TEXTAREA class=yk9 name=source rows=12 cols=45>脚本说明:
把如下代码加入<body>区域中
<script>
//---------这是区分播放器的音乐类型,你可以填加修改------//
var RS = new Array("rm","ram","mp3","ra","rt","rp","rmm","png","m3u","mp2","mpa");
//-----------播放器状态-------------//
var Rstate = new Array("停止","连接","缓冲","播放","暂停");
var player_doing = false;
function choose_player(sound_path)
{
sound_path = sound_path.split(".");
var sound_type = sound_path[sound_path.length-1].toLowerCase();
for(i=0;i<RS.length;i++)
{
if(sound_type==RS)
return "R"
}
return "U";
}
function Do_play()
{
var the_player = document.getElementById("player");
the_player.DoPlay();
}
function Do_pause()
{
var the_player = document.getElementById("player");
the_player.DoPause();
}
function Do_stop()
{
var the_player = document.getElementById("player");
the_player.DoStop();
}
function Set_position(num)
{
var the_player = document.getElementById("player");
the_player.SetPosition(num);
}
function Get_position()
{
var the_player = document.getElementById("player");
return the_player.GetPosition();
}
function Get_length()
{
var the_player = document.getElementById("player");
return the_player.GetLength();
}
function Set_volume(num)
{
var the_player = document.getElementById("player");
the_player.SetVolume(num);
}
function Show_time(num)
{
var time_minute = Math.floor( num / 60000 );
var time_second = Math.floor( ( num - time_minute*60000 ) / 1000 );
if( time_minute < 10 )
time_minute = "0" + time_minute;
if( time_second < 10 )
time_second = "0" + time_second;
return (time_minute + ":" +time_second);
}
function Get_state()
{
var the_player = document.getElementById("player");
return the_player.GetPlayState();
}
function player_play()
{
var just_type = choose_player(document.getElementById("sound_path").value);
var the_player = document.getElementById("player");
var the_state = Get_state();
if(the_state==1||the_state==2||the_state==3)
{
return;
}
if(the_state==4)
{
Do_play();
}
if(the_state==0)
{
if(just_type=="R")
{
Do_stop();
the_player.SetSource(document.getElementById("sound_path").value);
Do_play();
if(player_doing)
{
clearInterval(player_doing)
}
player_doing = setInterval("Set_all()",500);
}
}
}
function Set_all()
{
var the_player = document.getElementById("player");
document.getElementById("position_box").value = Show_time(Get_position());
document.getElementById("length_box").value = Show_time(Get_length());
document.getElementById("state_box").value = Rstate[Get_state()];
var the_max = (document.getElementById("position_button_box").offsetWidth - document.getElementById("position_button").offsetWidth);
document.getElementById("position_button").style.pixelLeft = Math.round(the_max*Get_position()/Get_length());
if(Get_state()==0)
{
clearInterval(player_doing);
}
}
function Go_direction(num)
{
var the_player = document.getElementById("player");
var the_state = Get_state();
if(the_state==3)
{
var the_direction = num*1000;
var judger = (Get_position() + the_direction)
if(judger>=0&&judger<=Get_length())
{
Set_position(judger);
}
}
}
var Ox,Nx;
var move_obj_can_move = false;
var move_obj = false;
function start_move()
{
move_obj_can_move = true;
move_obj = event.srcElement.id;
document.getElementById(move_obj).setCapture();
Ox = event.clientX;
}
function document.onmouseup()
{
if(!move_obj)
return;
document.getElementById(move_obj).releaseCapture();
move_obj_can_move = false;
move_obj = false;
}
function document.onmousemove()
{
if(!document.getElementById(move_obj))
{
return;
}
if(move_obj=="position_button"&&Get_state()!=3)
{
return;
}
Nx = event.clientX;
var judger = document.getElementById(move_obj).style.pixelLeft + Nx - Ox;
var max = document.getElementById(move_obj+"_box").offsetWidth - document.getElementById(move_obj).offsetWidth;
if(!move_obj_can_move||!move_obj||judger>max||judger<0)
{
return;
}
document.getElementById(move_obj).style.pixelLeft += Nx - Ox;
eval(move_obj+"_event("+document.getElementById(move_obj).style.pixelLeft+","+max+")");
Ox = Nx;
}
function volume_button_event(s_num,b_num)
{
var judger = Math.round(100*s_num/b_num)
if(judger>=0&&judger<=100)
{
Set_volume(judger)
}
}
function position_button_event(s_num,b_num)
{
var judger = Math.round(Get_length()*s_num/b_num);
if(judger>=0||judger<=Get_length())
{
Set_position(judger)
}
}
</script>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="37%">
<embed src="///d:/My%20Documents/My%20Webs/ling.mp3" type="audio/x-pn-realaudio-plugin" id="player" controls="ImageWindow,ControlPanel" width="273" height="183" >
</td>
<td width="63%" valign="top">
<input type="button" value="播放" onclick="player_play()">
<input type="button" value="暂停" onclick="Do_pause()">
<input type="button" value="停止" onclick="Do_stop()">
<input type="button" value="<<<" onmousedown="Go_direction(-1)">
<input type="button" value=">>>" onmousedown="Go_direction(1)">
<p> <input type="file" id="sound_path" style="width: 163; height: 23" id="state_box">
STATE:<input type="text" value="" size="10" id="state_box">
</p>
<p>
POSITION: <input type="text" value="" size="10" id="position_box"> LENGTH: <input type="text" value="" size="11" id="length_box">
</p>
<div align="left">
<table border="0" width="67%" cellspacing="0" cellpadding="0">
<tr>
<td id="volume_button_box" width="100%" bgcolor="#C0C0C0">
<input id="volume_button" type="button" value="音量" style="position: relative; left:100; height: 18; width: 32" onmousedown="start_move()">
</td>
</tr>
</table>
</div>
<p>
<div align="left">
<table border="0" width="67%" cellspacing="0" cellpadding="0">
<tr>
<td id="position_button_box" width="100%" bgcolor="#C0C0C0">
<input id="position_button" type="button" value="NOW" style="position: relative; left:0; height: 18; width: 32" onmousedown="start_move()">
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</TEXTAREA>
<SCRIPT language=JavaScript>
<!-- hide
function goHist(a)
{
history.go(a);
}
//-->
</SCRIPT>
<FORM method=post><INPUT style="COLOR: rgb(255,255,255); BACKGROUND-COLOR: #8000ff" onclick=goHist(-1) type=button value=返回>
</FORM></CENTER><BR><BR></BODY></HTML>

