home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Minami 79
/
MINAMI79.iso
/
Extra
/
MPSetup.exe
/
1033
/
RCDATA
/
CABINET
/
wmploc.DLL
/
256
/
142
< prev
next >
Wrap
Text File
|
2002-12-14
|
23KB
|
888 lines
// Windows Media Player - Copyright 2001 Microsoft Corporation.
var g_psPlayState=0;
var g_osOpenState=0;
var g_fIsLiveBroadcast=false;
var g_StatusTextColor="#89A4FF";
var g_bufferingProgress=100;
var g_bufferingToolTipFormatString = theme.loadString("res://wmploc/RT_STRING/#2099");
var g_strPlayTooltip = "";
var g_SetPlayPauseFocus=false;
var g_kSeekTooltip = theme.loadString("res://wmploc/RT_STRING/#1809");
var g_fSeekDragging=false;
var g_strPlayIcon="res://wmploc/RT_IMAGE/#1784";
function ResetPlayIcon()
{
g_strPlayIcon="res://wmploc/RT_IMAGE/#1784";
}
function InitMiniControls()
{
g_bufferingProgress = player.network.bufferingProgress;
OnOpenStateChangeTransport(player.openState);
OnPlayStateChangeTransport(player.playState);
OnStatusChangeTransport(player.status);
}
/*
var g_fShowingBuyMe=false;
function LaunchBuy()
{
var BuyURL = 'http://go.microsoft.com/fwlink?prd=766&pver=9.0&plcid=0x' + mediacenter.getNamedString("PLCID") + '&ar=BuyNow&sar=' + mediacenter.getNamedString("BuyMusicURL");
player.launchURL( BuyURL );
}
*/
function MetaDataObject( formatStringID, dataCode, fEvalEveryTime, urlCode, tooltipCode )
{
this.formatString = getFormatString(formatStringID);
this.dataCode = dataCode;
this.fEvalEveryTime = (fEvalEveryTime==true);
this.urlCode = urlCode ? urlCode : '""';
this.tooltipCode= tooltipCode ? tooltipCode : '""';
this.str = "";
this.url = "";
this.toolTip = "";
this.getDataString = getDataString;
this.init = initMetaDataObject;
}
function getDataString()
{
if (false==this.fEvalEveryTime)
{
return this.str;
}
else
{
return getFormattedDataString(this.formatString, this.dataCode);
}
}
function initMetaDataObject()
{
this.str = getFormattedDataString(this.formatString,this.dataCode);
this.url = eval(this.urlCode);
this.toolTip = eval(this.tooltipCode);
}
function MetaDataDefinitionSet ( arrayOfMetaDataObjects, testCode)
{
this.arrayOfMetaDataObjects = arrayOfMetaDataObjects;
this.testCode = testCode;
}
function getMInfo(itemName)
{
if (player.openState==osMediaOpen)
{
return player.currentMedia.getItemInfo(itemName);
}
return "";
}
function getPInfo(itemName)
{
return player.currentPlaylist.getItemInfo(itemName);
}
var g_sAudioMetaData = new Array
( //formatStringID, script to get data
new MetaDataObject ( "", "player.status", true ),
new MetaDataObject ( "", "GetServerString()", true, "theme.loadString('res://wmploc/RT_STRING/#2068');"),
new MetaDataObject ( "2070", "getMInfo('album')", true, "getMInfo('moreinforef')", "getMInfo('abstract')" ),
new MetaDataObject ( "2071", "if(player.openState==osMediaOpen)player.currentMedia.name; else '';", true, "getPInfo('moreinforef')", "getPInfo('abstract')" ),
new MetaDataObject ( "2072", "getMInfo('author')",true ),
new MetaDataObject ( "2076", "getMInfo('copyright')",true ),
new MetaDataObject ( "", "GetDRMString(player.currentMedia)" )
);
var g_sVideoMetaData = new Array
( //formatStringID, script to get data
new MetaDataObject ( "", "player.status", true),
new MetaDataObject ( "", "GetServerString()", true, "theme.loadString('res://wmploc/RT_STRING/#2068');"),
new MetaDataObject ( "2073", "getPInfo('title')", true, "getPInfo('moreinforef')", "getPInfo('abstract')" ),
new MetaDataObject ( "2074", "if(player.openState==osMediaOpen)player.currentMedia.name; else '';", true, "getMInfo('moreinforef')", "getMInfo('abstract')" ),
new MetaDataObject ( "2075", "getMInfo('author')", true ),
new MetaDataObject ( "2076", "getMInfo('copyright')", true ),
new MetaDataObject ( "", "GetDRMString(player.currentMedia)")
);
var g_sDVDMetaData = new Array
( //formatStringID, script to get data
new MetaDataObject ( "", "player.status", true),
new MetaDataObject ( "2082", "getMInfo('Author')", true),
new MetaDataObject ( "2083", "getMInfo('Studio')", true ),
new MetaDataObject ( "", "GetChapterTitleString()", true)
);
var g_sMetaDataDefinitionSets = new Array
(
new MetaDataDefinitionSet ( g_sAudioMetaData, "(player.dvd.isAvailable('dvd')==false) && (player.currentMedia.imageSourceHeight==0)"),
new MetaDataDefinitionSet ( g_sVideoMetaData, "(player.dvd.isAvailable('dvd')==false) && (player.currentMedia.imageSourceHeight>0)" ),
new MetaDataDefinitionSet ( g_sDVDMetaData, "player.dvd.isAvailable('dvd')==true" )
);
function getNextMetaDataObject()
{
this.currentIndex = (this.currentIndex + 1) % this.metaDataCollection.length;
return this.metaDataCollection[this.currentIndex];
}
function clear()
{
this.metaDataCollection.length=0;
this.currentIndex = 0;
}
function append(mdObject)
{
this.metaDataCollection[this.metaDataCollection.length] = mdObject;
}
function getItem(index)
{
this.currentIndex = index-1;
return this.getNextMetaDataObject();
}
function MetaDataCollectionManager()
{
this.metaDataCollection = new Array();
this.currentIndex = 0;
this.getNextMetaDataObject = getNextMetaDataObject;
this.clear = clear;
this.append = append;
this.getItem = getItem;
}
var g_MetaDataCollectionManager = new MetaDataCollectionManager();
function InitMetaDataCollection()
{
g_MetaDataCollectionManager.clear();
var CurrentSet;
for (var mdList in g_sMetaDataDefinitionSets)
{
CurrentSet = g_sMetaDataDefinitionSets[mdList];
if ( eval(CurrentSet.testCode) )
{
break;
}
}
var allTypes = CurrentSet.arrayOfMetaDataObjects;
for (var index in allTypes)
{
var mdObject = allTypes[index];
mdObject.init();
if ( (mdObject.str!="") || mdObject.fEvalEveryTime )
{
g_MetaDataCollectionManager.append(mdObject);
}
}
ShowStatus(player.status);
}
function getFormatString(formatStringID)
{
if (""==formatStringID)
{
return "";
}
return theme.loadString("res://wmploc/RT_STRING/#" + formatStringID);
}
function getFormattedDataString(formatString, dataCode)
{
var data = eval(dataCode);
if (data=="")
{
return "";
}
if (""!=formatString)
{
data=data.sprintf(formatString,data);
}
return data;
}
function GetChapterTitleString()
{
if (player.openState!=osMediaOpen)
{
return "";
}
var DVDChapterANDTitleFormatString = theme.loadString("res://wmploc/RT_STRING/#2086");
var title = player.currentPlaylist.name;
var chapter = player.currentMedia.name;
//jcain - DON'T CHANGE THE ORDER OF THESE ARGUMENTS!!! (title, chapter)
//their order is vital to sprintf formattting them properly for localization
var arguments = new Array (title,chapter);
var TitleAndChapter = "";
TitleAndChapter = TitleAndChapter.sprintf(DVDChapterANDTitleFormatString, arguments);
return TitleAndChapter;
}
function GetServerString()
{
var ServerVersionString = getMInfo("WMServerVersion");
if (ServerVersionString != "" && (parseInt(ServerVersionString)>=9))
{
return theme.loadString("res://wmploc/RT_STRING/#2069");
}
return "";
}
function GetDRMString(obj)
{
var str = "";
if ("True" == obj.getItemInfo("Is_Protected"))
{
if ("True" == obj.getItemInfo("Is_Trusted"))
{
str = theme.loadString("res://wmploc/RT_STRING/#2078");
var signame = obj.getItemInfo("Signature_Name");
str = str.sprintf(str,signame);
}
else
{
str = theme.loadString("res://wmploc/RT_STRING/#2077");
}
}
return str;
}
var g_metaDataInfo;
function ShowMetaData(mdObject)
{
if (mdObject)
{
g_metaDataInfo = mdObject;
var str = mdObject.getDataString();
if ("" != str)
{
metadata.value = str;
metadata.tooltip = mdObject.tooltip;
if ("" != mdObject.url)
{
metadata.enabled = true;
if (metadata.hoverFontStyle=="normal")
{
metadata.hoverFontStyle = "underline";
}
else
{
metadata.hoverFontStyle = metadata.fontStyle + " underline";
}
metadata.cursor="hand";
}
else
{
metadata.hoverFontStyle = metadata.fontStyle;
metadata.cursor="system";
metadata.enabled = false;
}
metadata.toolTip = mdObject.toolTip;
}
}
else
{
ShowStatus(player.status);
}
}
function ShowStatus(sStr)
{
metadata.value = sStr;
metadata.hoverFontStyle = "normal";
metadata.cursor="system";
metadata.tooltip = "";
metadata.enabled = false;
}
function RotateMetaData()
{
var currentMetaDataObject = g_MetaDataCollectionManager.getNextMetaDataObject();
ShowMetaData(currentMetaDataObject);
}
function ForceMetaData(itemIndex)
{
var meta = g_MetaDataCollectionManager.getItem(itemIndex);
ShowMetaData(meta);
}
function OnClickMetaData()
{
if ("" != g_metaDataInfo.url)
player.launchURL(g_metaDataInfo.url);
}
function UpdateReceptionQuality(nReceptionQuality)
{
if ( player.network.bufferingProgress < 100 )
{
return;
}
var protocol = player.network.sourceProtocol;
if ( (protocol=="file") || (protocol=="") )
{
return;
}
if ( (g_strPlayIcon == "WMPImage_PlaybackIcon")&&
(player.network.maxBitrate==player.network.bitRate)&&
(nReceptionQuality == 100) )
{
return;
}
var IDIM_OLDSTRIMG_T1_14_NORMAL=1776;
var IDIM_OLDSTRIMG_T1_14_PACKETLOSS=1777;
var IDIM_OLDSTRIMG_T1_56_NORMAL=1778;
var IDIM_OLDSTRIMG_T1_56_PACKETLOSS=1779;
var IDIM_OLDSTRIMG_T1_T1_NORMAL=1780;
var IDIM_OLDSTRIMG_T1_T1_PACKETLOSS=1781;
var IDIM_OLDSTRIMG_PACKETLOSS10=1772;
var imagename = "res://wmploc/RT_IMAGE/#";
var maxBitrate = player.network.maxBitrate;
var currentBitrate = player.network.bitRate;
var imageId=0;
if (currentBitrate==maxBitrate)
{
imageId=IDIM_OLDSTRIMG_T1_T1_NORMAL;
}
else
{
if (currentBitrate >= (maxBitrate/2))
{
imageId=IDIM_OLDSTRIMG_T1_56_NORMAL;
}
else
{
imageId=IDIM_OLDSTRIMG_T1_14_NORMAL;
}
}
if (nReceptionQuality > 0)
{
if(nReceptionQuality == 100)
{
if (currentBitrate==maxBitrate)
{
QualityIcon.upToolTip="res://wmploc/RT_STRING/#2079";
}
else
{
QualityIcon.upToolTip="res://wmploc/RT_STRING/#2092";
}
}
else if( nReceptionQuality >= 95 )
{
imageId +=1; //packet loss is one more the normal
QualityIcon.upToolTip="res://wmploc/RT_STRING/#2080";
}
else if(nReceptionQuality < 95)
{
imageId = IDIM_OLDSTRIMG_PACKETLOSS10;
QualityIcon.upToolTip="res://wmploc/RT_STRING/#2081";
}
imagename += imageId;
QualityIcon.image = imagename;
QualityIcon.visible=true;
}
}
function OnTimerTransport()
{
if (osMediaOpen != g_osOpenState)
return;
switch(g_psPlayState)
{
case psPlaying:
RotateMetaData();
break;
}
}
function OnStatusChangeTransport()
{
view.timerInterval=0;
view.timerInterval=4000;
ShowStatus(player.status);
}
function OnBufferingChangeTransport(nProgress)
{
if ( nProgress!=g_bufferingProgress)
{
g_bufferingProgress=nProgress;
}
else
{
return;
}
if (nProgress == 100)
{
QualityIcon.image = "res://wmploc/RT_IMAGE/#1776";
QualityIcon.upToolTip="";
return;
}
if (nProgress > 50)
{
if (nProgress > 75)
{
QualityIcon.image = "res://wmploc/RT_IMAGE/#1774";
}
else
{
QualityIcon.image = "res://wmploc/RT_IMAGE/#1773";
}
}
else
{
if (nProgress>25)
{
QualityIcon.image = "res://wmploc/RT_IMAGE/#1771";
}
else
{
QualityIcon.image = "res://wmploc/RT_IMAGE/#1770";
}
}
var toolTip = "";
toolTip = toolTip.sprintf(g_bufferingToolTipFormatString, nProgress.toString());
QualityIcon.upToolTip=toolTip;
ShowStatus(player.status);
}
function OnDisconnectTransport()
{
ShowStatus(theme.loadString("res://wmploc/RT_STRING/#2063"));
}
function PlayButtonClick(event)
{
if( (player.playState==psPaused) && (event.ctrlKey) && player.controls.isAvailable('step') )
{
if (event.shiftKey)
{
player.controls.step(-1);
}
else
{
player.controls.step(1);
}
}
else
{
g_SetPlayPauseFocus=true;
player.controls.play();
}
}
function OnFFWD()
{
if (player.PlayState == psScanForward)
{
player.controls.play();
}
else
{
player.controls.FastForward();
}
}
function OnREW()
{
if (player.PlayState == psScanReverse)
{
player.controls.play();
}
else
{
player.controls.FastReverse();
}
}
function volumeOnChange()
{
player.settings.mute=false;
}
function muteOnClick()
{
player.settings.mute = (player.settings.mute == true) ? false : true;
}
function ShowPlaybackIcon()
{
g_strPlayIcon = "WMPImage_PlaybackIcon";
g_strPlayTooltip="";
if (player.playState==psPlaying)
{
QualityIcon.image = g_strPlayIcon;
QualityIcon.upToolTip = g_strPlayTooltip;
QualityIcon.visible=true;
}
}
var g_IconURL="";
function CheckForDecodingIcons()
{
var HDCDMode = parseInt(player.currentPlaylist.getItemInfo("HDCDMode"));
if (HDCDMode==1)
{
g_strPlayIcon = "res://wmploc/RT_IMAGE/#1787";
g_strPlayTooltip = theme.loadString("res://wmploc/RT_STRING/#2098");
g_IconURL = mediacenter.getNamedString("HDCD_URL");
return;
}
else if (HDCDMode==2)
{
g_strPlayIcon = "res://wmploc/RT_IMAGE/#2030";
g_strPlayTooltip = theme.loadString("res://wmploc/RT_STRING/#2097");
g_IconURL = mediacenter.getNamedString("HDCD_URL");
return;
}
if (g_strPlayIcon != "WMPImage_PlaybackIcon")
{
g_strPlayIcon = "res://wmploc/RT_IMAGE/#1784";
g_strPlayTooltip = "";
g_IconURL = "";
}
}
function OnPlayStateChangeTransport(NewState)
{
g_psPlayState=NewState;
switch (NewState)
{
case psUndefined:
seek.foregroundProgress = 0;
rew.down=false;
ffwd.down=false;
break;
case psTransitioning:
rew.down=false;
ffwd.down=false;
break;
case psReady:
QualityIcon.visible=false;
QualityIcon.upToolTip = "";
seek.foregroundProgress = 0;
rew.down=false;
ffwd.down=false;
break;
case psStopped:
QualityIcon.visible=true;
QualityIcon.image = "res://wmploc/RT_IMAGE/#2024";
QualityIcon.upToolTip = "";
ffwd.down=false;
rew.down=false;
break;
case psPaused:
QualityIcon.visible=true;
QualityIcon.image = "res://wmploc/RT_IMAGE/#2023";
QualityIcon.upToolTip = "";
ffwd.down=false;
rew.down=false;
break;
case psPlaying:
ShowPlayingIcon();
ShowStatus(player.status);
ffwd.down=false;
rew.down=false;
break;
case psWaiting:
rew.down=false;
ffwd.down=false;
break;
case psScanForward:
ShowPlayingIcon();
rew.down=false;
ffwd.down=true;
break;
case psScanReverse:
ShowPlayingIcon();
rew.down=true;
ffwd.down=false;
break;
case psBuffering:
break;
case psReconnecting:
break;
}
}
function ShowPlayingIcon()
{
var sp = player.network.sourceProtocol;
if ( (sp=="file") || (sp=="") || (g_strPlayIcon == "WMPImage_PlaybackIcon") )
{
CheckForDecodingIcons();
QualityIcon.image = g_strPlayIcon;
QualityIcon.upToolTip = g_strPlayTooltip;
QualityIcon.visible=true;
}
else
{
UpdateReceptionQuality(player.network.receptionQuality);
}
}
function OnOpenStateChangeTransport(NewState)
{
g_osOpenState=NewState;
switch (NewState)
{
case osUndefined:
tracktime.visible=false;
g_fIsLiveBroadcast=false;
break;
case osPlaylistChanging:
break;
case osPlaylistLocating:
break;
case osPlaylistConnecting:
break;
case osPlaylistLoading:
break;
case osPlaylistOpening:
break;
case osPlaylistOpenNoMedia:
break;
case osPlaylistChanged:
break;
case osMediaChanging:
QualityIcon.visible = false;
ResetPlayIcon();
break;
case osMediaLocating:
QualityIcon.visible=true;
QualityIcon.image = "res://wmploc/RT_IMAGE/#1783";
QualityIcon.upToolTip="";
break;
case osMediaConnecting:
QualityIcon.visible=true;
QualityIcon.image = "res://wmploc/RT_IMAGE/#1783"; // uses same image as Locating
QualityIcon.upToolTip="";
break;
case osMediaLoading:
break;
case osMediaWaiting:
g_fIsLiveBroadcast = (player.currentMedia.getItemInfo("Type") == "broadcast");
seek.enabled = !g_fIsLiveBroadcast;
break;
case osMediaOpening:
QualityIcon.visible=true;
QualityIcon.image = "res://wmploc/RT_IMAGE/#2020";
QualityIcon.upToolTip="";
g_strPlayIcon = "res://wmploc/RT_IMAGE/#1784";
g_strPlayTooltip = "";
break;
case osMediaOpen:
tracktime.visible=true;
g_fIsLiveBroadcast = (player.currentmedia.getiteminfo("Type") == "broadcast");
seek.enabled = !g_fIsLiveBroadcast;
InitMetaDataCollection();
break;
case osBeginLicenseAcquisition:
break;
case osEndLicenseAcquisition:
break;
case osBeginIndividualization:
break;
case osEndIndividualization:
break;
default:
break;
}
}
function getFormattedValue(value)
{
if (player.openState!=osMediaOpen)
{
return "";
}
if (!g_kPositionFormatString)
{
g_kPositionFormatString = theme.loadString("res://wmploc/RT_STRING/#2091");
}
var currentValue;
try
{
currentValue = app.getTimeString(value);
}
catch(err)
{
currentValue = helper.getTimeString(value);
}
var totalTime = player.currentMedia.durationString;
var format = g_kPositionFormatString;
format = format.replace(/%1/i, currentValue);
format = format.replace(/%2/i, totalTime);
return format;
}
function getDarkTextColor()
{
return mediacenter.appColorDark;
}
function getHighlightTextColor()
{
return mediacenter.itemPlayingColor;
}
//----------------------------------------------------------------
// multi-speed fastforward logic
var g_kFFWD_Down1 = "res://-/#1897";
var g_kFFWD_Down2 = "res://-/#2082";
var g_kFFWD_Down3 = "res://-/#2083";
var g_kFastForwardRate1 = 1.4;
var g_kFastForwardRate2 = 2.0;
var g_kFastForwardRate3 = 5.0;
function SyncFFWDButtonToRate(rate)
{
var tc = player.controls.isAvailable("timeCompression");
if ( rate < g_kFastForwardRate1 )
{
ffwdGroup.downImage=g_kFFWD_Down1;
if( !tc )
{
ffwd_multi.upToolTip="res://wmploc/RT_STRING/#1804"
}
else
{
ffwd_multi.upToolTip="res://wmploc/RT_STRING/#2194"
}
ffwd_multi.down = false;
}
else if (rate < g_kFastForwardRate2)
{
ffwdGroup.downImage=g_kFFWD_Down1;
if( !tc )
{
ffwd_multi.downToolTip="res://wmploc/RT_STRING/#1804"
ffwd_multi.down = false;
}
else
{
ffwd_multi.downToolTip="res://wmploc/RT_STRING/#2195"
ffwd_multi.down = true;
}
}
else if (rate < g_kFastForwardRate3)
{
if( !tc )
{
ffwd_multi.downToolTip="res://wmploc/RT_STRING/#1804"
ffwdGroup.downImage=g_kFFWD_Down1;
ffwd_multi.down = false;
}
else
{
ffwdGroup.downImage=g_kFFWD_Down2;
ffwd_multi.downToolTip="res://wmploc/RT_STRING/#2196"
ffwd_multi.down = true;
}
}
else
{
if( !tc )
{
ffwdGroup.downImage=g_kFFWD_Down1;
}
else
{
ffwdGroup.downImage=g_kFFWD_Down3;
}
ffwd_multi.downToolTip="res://wmploc/RT_STRING/#1818"
ffwd_multi.down = true;
}
}
function OnFFWDMultiSpeed()
{
var tc = player.controls.isAvailable("timeCompression");
var rate = player.settings.rate;
if (rate < g_kFastForwardRate1 && tc)
{
player.settings.rate=g_kFastForwardRate1;
}
else if (rate<g_kFastForwardRate2 && tc)
{
player.settings.rate=g_kFastForwardRate2;
}
else if (rate<g_kFastForwardRate3)
{
player.settings.rate=g_kFastForwardRate3;
}
else
{
player.settings.rate=1;
}
}