home *** CD-ROM | disk | FTP | other *** search
- // Windows Media Player - Copyright 2000 Microsoft Corporation.
- //<script>
-
- var g_fCaptionsDetected = false;
- var g_fSyncLyricsDetected = false;
-
- function CaptionsView_OnOpenStateChangeEvent(NewState)
- {
- switch (NewState)
- {
- case osMediaChanging:
- ClearDisplay();
- break;
- case osMediaOpen:
- InitDisplay();
- break;
- }
- }
-
- function handleScriptCommand(scType, Param)
- {
- scType = scType.toUpperCase();
-
- if(scType == "TEXT" || scType == "<SYNC" || scType == "CAPTION")
- {
- UpdateDisplay( Param, "" );
- }
- else if ( (!g_fCaptionsDetected) && scType=="SYNCHRONIZEDLYRICLYRIC" )
- {
- UpdateDisplay( "", Param );
- }
- }
-
- function InitDisplay()
- {
- g_fCaptionsDetected = false;
- g_fSyncLyricsDetected = false;
- UpdateDisplay( "", "" );
- }
-
- function UpdateDisplay( Captions, Lyrics )
- {
- // SAMI
-
- if( Captions == "" )
- {
- Captions = helper.getCurrentScriptCommand( "TEXT" );
- }
- if( Captions == "" )
- {
- Captions = helper.getCurrentScriptCommand( "<SYNC" );
- }
- if( Captions == "" )
- {
- Captions = helper.getCurrentScriptCommand( "CAPTION" );
- }
- if( Captions != "" )
- {
- g_fCaptionsDetected = true;
- ShowCaptions( Captions );
- }
-
- if( g_fCaptionsDetected )
- {
- return;
- }
-
- // Sync Lyrics
-
- if( Lyrics == "" )
- {
- Lyrics = helper.getCurrentScriptCommand( "SYNCHRONIZEDLYRICLYRIC" );
- }
- if( Lyrics != "" )
- {
- g_fSyncLyricsDetected = true;
- ShowLyrics( Lyrics );
- }
-
- if( g_fSyncLyricsDetected )
- {
- return;
- }
-
- // Unsync Lyrics
-
- if( player.currentMedia && ( player.currentMedia.getAttributeCountByType("WM/Lyrics", "") > 0 ) )
- {
- var strLyrics = player.currentMedia.getItemInfo("WM/Lyrics");
- ShowLyrics( strLyrics );
- }
- }
-
- function ClearDisplay()
- {
- if (Browser1.URL=="SAMI")
- {
- Browser1.showSAMIText("");
- }
- else if (Browser1.URL=="Lyrics")
- {
- Browser1.showLyrics("");
- }
- }
-
- function ShowCaptions( strText )
- {
- if (Browser1.URL!="SAMI")
- {
- Browser1.loadSpecialPage("SAMI");
- }
-
- Browser1.showSAMIText(strText);
- }
-
- function ShowLyrics( strText )
- {
- if (Browser1.URL != "Lyrics")
- {
- Browser1.loadSpecialPage("Lyrics");
- }
-
- Browser1.showLyrics(strText);
- }
-
-