home *** CD-ROM | disk | FTP | other *** search
/ Minami 79 / MINAMI79.iso / Extra / MPSetup.exe / 1033 / RCDATA / CABINET / wmploc.DLL / 256 / CAPTIONS.JS < prev    next >
Text File  |  2002-12-14  |  3KB  |  126 lines

  1. // Windows Media Player - Copyright 2000 Microsoft Corporation.
  2. //<script>
  3.  
  4. var g_fCaptionsDetected = false;
  5. var g_fSyncLyricsDetected = false;
  6.  
  7. function CaptionsView_OnOpenStateChangeEvent(NewState)
  8. {
  9.         switch (NewState)
  10.         {
  11.         case osMediaChanging:
  12.                 ClearDisplay();
  13.                 break;
  14.         case osMediaOpen:
  15.                 InitDisplay();
  16.                 break;
  17.         }
  18. }
  19.  
  20. function handleScriptCommand(scType, Param)
  21. {
  22.         scType = scType.toUpperCase();
  23.  
  24.         if(scType == "TEXT" ||  scType == "<SYNC" || scType == "CAPTION")
  25.         {
  26.                 UpdateDisplay( Param, "" );
  27.         }
  28.         else if ( (!g_fCaptionsDetected) && scType=="SYNCHRONIZEDLYRICLYRIC" )
  29.         {
  30.                 UpdateDisplay( "", Param );
  31.         }
  32. }
  33.  
  34. function InitDisplay()
  35. {
  36.         g_fCaptionsDetected = false;
  37.         g_fSyncLyricsDetected = false;
  38.         UpdateDisplay( "", "" );
  39. }
  40.  
  41. function UpdateDisplay( Captions, Lyrics )
  42. {
  43.         // SAMI
  44.  
  45.         if( Captions == "" )
  46.         {
  47.                 Captions = helper.getCurrentScriptCommand( "TEXT" );
  48.         }
  49.         if( Captions == "" )
  50.         {
  51.                 Captions = helper.getCurrentScriptCommand( "<SYNC" );
  52.         }
  53.         if( Captions == "" )
  54.         {
  55.                 Captions = helper.getCurrentScriptCommand( "CAPTION" );
  56.         }
  57.         if( Captions != "" )
  58.         {
  59.                 g_fCaptionsDetected = true;
  60.                 ShowCaptions( Captions );
  61.         }
  62.  
  63.         if( g_fCaptionsDetected )
  64.         {
  65.                 return;
  66.         }
  67.  
  68.         // Sync Lyrics
  69.  
  70.         if( Lyrics == "" )
  71.         {
  72.                 Lyrics = helper.getCurrentScriptCommand( "SYNCHRONIZEDLYRICLYRIC" );
  73.         }
  74.         if( Lyrics != "" )
  75.         {
  76.                 g_fSyncLyricsDetected = true;
  77.                 ShowLyrics( Lyrics );
  78.         }
  79.  
  80.         if( g_fSyncLyricsDetected )
  81.         {
  82.                 return;
  83.         }
  84.  
  85.         // Unsync Lyrics
  86.  
  87.         if( player.currentMedia && ( player.currentMedia.getAttributeCountByType("WM/Lyrics", "") > 0 ) )
  88.         {
  89.                 var strLyrics = player.currentMedia.getItemInfo("WM/Lyrics");
  90.                 ShowLyrics( strLyrics );
  91.         }
  92. }
  93.  
  94. function ClearDisplay()
  95. {
  96.         if (Browser1.URL=="SAMI")
  97.         {
  98.                 Browser1.showSAMIText("");
  99.         }
  100.         else if (Browser1.URL=="Lyrics")
  101.         {
  102.                 Browser1.showLyrics("");
  103.         }
  104. }
  105.  
  106. function ShowCaptions( strText )
  107. {
  108.         if (Browser1.URL!="SAMI")
  109.         {
  110.                 Browser1.loadSpecialPage("SAMI");
  111.         }
  112.  
  113.         Browser1.showSAMIText(strText);
  114. }
  115.  
  116. function ShowLyrics( strText )
  117. {
  118.         if (Browser1.URL != "Lyrics")
  119.         {
  120.                 Browser1.loadSpecialPage("Lyrics");
  121.         }
  122.  
  123.         Browser1.showLyrics(strText);
  124. }
  125.  
  126.