home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Minami 48
/
MINAMI48.ISO
/
Extra
/
MPSetupXP.exe
/
1033
/
RCDATA
/
CABINET
/
9SeriesDefault.wmz
/
metadata.js
< prev
next >
Wrap
Text File
|
2002-10-08
|
21KB
|
776 lines
// Windows Media Player - Copyright 2001 Microsoft Corporation.
var g_strPlayImage="";
var g_strPlayHover="";
var g_strPlayDown="";
var g_strPauseHover="";
var g_strPauseDown="";
var g_strPauseUp="";
var g_psPlayState=0;
var g_osOpenState=0;
var g_fIsLiveBroadcast=false;
var g_fShowingBuyMe=false;
var g_bufferingProgress=100;
var g_bufferingToolTipFormatString = theme.loadString("res://wmploc.dll/RT_STRING/#2099");
var g_strPlayTooltip = "";
var g_strPlayIcon="res://wmploc/RT_IMAGE/#1784";
function InitMiniControls()
{
g_bufferingProgress = player.network.bufferingProgress;
g_strPlayImage="res://wmploc.dll/RT_BITMAP/#373";
g_strPlayHover="res://wmploc.dll/RT_BITMAP/#374";
g_strPlayDown="res://wmploc.dll/RT_BITMAP/#375";
g_strPauseUp="res://wmploc.dll/RT_BITMAP/#427";
g_strPauseHover="res://wmploc.dll/RT_BITMAP/#423";
g_strPauseDown="res://wmploc.dll/RT_BITMAP/#424";
player.settings.enableErrorDialogs = false;
OnOpenStateChangeTransport(player.openState);
OnPlayStateChangeTransport(player.playState);
OnStatusChangeTransport(player.status);
}
function InitControls()
{
g_bufferingProgress = player.network.bufferingProgress;
if (mediacenter.contrastMode == "BW")
{
g_strPlayImage = "res://wmploc/#1691";
g_strPlayHover = "res://wmploc/#1691";
g_strPlayDown = "res://wmploc/#1691";
g_strPauseUp = "res://wmploc/#1686";
g_strPauseHover = "res://wmploc/#1686";
g_strPauseDown = "res://wmploc/#1686";
}
else if (mediacenter.contrastMode == "WB")
{
g_strPlayImage = "res://wmploc/#1698";
g_strPlayHover = "res://wmploc/#1698";
g_strPlayDown = "res://wmploc/#1698";
g_strPauseUp = "res://wmploc/#1685";
g_strPauseHover = "res://wmploc/#1685";
g_strPauseDown = "res://wmploc/#1685";
}
else
{
g_strPlayImage = "res://wmploc.dll/RT_BITMAP/#294";
g_strPlayHover = "res://wmploc.dll/RT_BITMAP/#293";
g_strPlayDown = "res://wmploc.dll/RT_BITMAP/#292";
g_strPauseUp = "res://wmploc.dll/RT_BITMAP/#288";
g_strPauseHover = "res://wmploc.dll/RT_BITMAP/#289";
g_strPauseDown = "res://wmploc.dll/RT_BITMAP/#290";
}
OnOpenStateChangeTransport(player.openState);
OnPlayStateChangeTransport(player.playState);
OnStatusChangeTransport(player.status);
}
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);
}
}
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 ( "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 ( "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 sprintf(str,s)
{
if (typeof(s)=="string")
{
var re;
re = /%s/i;
str = str.replace(re, s);
}
else
{
var index =1;
for (var replaceStrings in s)
{
var re;
re = eval("/%" + index + "/i");
str = str.replace(re, s[replaceStrings]);
index++;
}
}
return str;
}
String.prototype.sprintf = sprintf;
function GetDRMString(obj)
{
var str = "";
if ("true" == obj.getItemInfo("Is_Protected"))
{
if ("true" == obj.getItemInfo("Is_Trusted"))
{
str = theme.loadString("res://wmploc.dll/RT_STRING/#2078");
var signame = obj.getItemInfo("Signature_Name");
str = str.sprintf(str,signame);
}
else
{
str = theme.loadString("res://wmploc.dll/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.hoverFontStyle = metadata.fontStyle + " underline";
metadata.enabled = true;
}
else
{
metadata.hoverFontStyle = metadata.fontStyle;
metadata.enabled = false;
}
metadata.toolTip = mdObject.toolTip;
}
}
else
{
ShowStatus(player.status);
}
}
function ShowStatus(sStr)
{
metadata.value = sStr;
metadata.hoverFontStyle = "normal";
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;
}
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.dll/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.dll/RT_STRING/#2080";
}
else if(nReceptionQuality < 95)
{
imageId = IDIM_OLDSTRIMG_PACKETLOSS10;
QualityIcon.upToolTip="res://wmploc.dll/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()
{
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.dll/RT_STRING/#2063"));
}
function playOnClick()
{
if (player.PlayState == psPlaying)
{
player.controls.pause();
}
else
{
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 CheckForDecodingIcons()
{
var IconPaths = player.currentPlaylist.getItemInfo("IconPaths");
if (IconPaths=="")
{
var HDCDMode = parseInt(player.currentPlaylist.getItemInfo("HDCDMode"));
if (HDCDMode==1)
{
g_strPlayIcon = "res://wmploc/RT_IMAGE/#1787";
g_strPlayTooltip = theme.loadString("res://wmploc.dll/RT_STRING/#2098");
return;
}
else if (HDCDMode==2)
{
g_strPlayIcon = "res://wmploc/RT_IMAGE/#2030";
g_strPlayTooltip = theme.loadString("res://wmploc.dll/RT_STRING/#2097");
return;
}
}
else
{
//IconPaths can be a pipe-delimited set of image paths
var IconArray = IconPaths.split("|");
if (IconArray[0].indexOf("res://wmploc")==0)
{
//currently we're not handling multiple icons, so we just use
//the zeroth one. Furthermore, we don't yet support normal paths,
//only res://wmploc/#RESOURCE_ID
g_strPlayIcon = IconArray[0];
g_strPlayTooltip = "";
return;
}
}
g_strPlayIcon = "res://wmploc/RT_IMAGE/#1784";
g_strPlayTooltip = "";
}
function OnPlayStateChangeTransport(NewState)
{
g_psPlayState = NewState;
/*
if ( (NewState == psPlaying) || (NewState == psWaiting) )
{
switchToPlayButton(false);
}
else
{
switchToPlayButton(true);
}
*/
switch (NewState)
{
default:
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=="") )
{
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;
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/#1782";
QualityIcon.upToolTip = "";
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;
}
}