home *** CD-ROM | disk | FTP | other *** search
/ PC World 2001 August / PCWorld_2001-08_cd.bin / Software / Topware / winmpl71 / mp71.exe / RCDATA / CABINET / Classic.wmz / classic.js < prev    next >
Text File  |  2001-03-02  |  2KB  |  113 lines

  1. /*
  2.     ⌐2000 Microsoft Corporation. All rights reserved.
  3. */
  4.  
  5.  
  6. var g_fExpectingSizeChange  = false;
  7. var g_fUserHasSized         = false;
  8.  
  9.  
  10. function OnLoad()
  11. {
  12.     OnOpenStateChange();
  13.     OnPlayStateChange();
  14. }
  15.  
  16.  
  17. function OnURLChange()
  18. {
  19.     if (player.URL == "")
  20.         view.title = xWMP.toolTip;
  21.     else
  22.         view.title = player.URL;
  23. }
  24.  
  25.  
  26. function SizeChange()
  27. {
  28.     if (!g_fExpectingSizeChange)
  29.     {
  30.         g_fUserHasSized = true;
  31.     }
  32. }
  33.  
  34. function StartPlaying()
  35. {
  36.     if (player.currentMedia.ImageSourceHeight == 0)
  37.     {
  38.         view.height = 359 - 183;
  39.     }
  40.     else
  41.     {
  42.         wmlogo.visible = false;
  43.  
  44.         // resize to the video size
  45.         // we'll do this if we're stretch to fit and the user hasn't sized us yet,
  46.         // or if we're not stretch to fit (zoom level is set)
  47.  
  48.         if ((!g_fUserHasSized && mediacenter.videoStretchToFit) || !mediacenter.videoStretchToFit)
  49.         {
  50.             var zoom = mediacenter.videoStretchToFit ? 100 : mediacenter.videoZoom;
  51.  
  52.             var x = (player.currentMedia.imageSourceWidth * (zoom / 100.0));
  53.             if (x < 285) 
  54.             {
  55.                 x = 285;
  56.             }
  57.             var y = (player.currentMedia.imageSourceHeight * (zoom / 100.0));
  58.  
  59.             g_fExpectingSizeChange = true;
  60.             view.width = x;
  61.             view.height = 359 - 183 + y;
  62.             g_fExpectingSizeChange = false;
  63.         }
  64.     }
  65.     stereo.backgroundImage = 'icon_stereo.bmp';
  66.     UpdateMetadata();
  67. }
  68.  
  69.  
  70. function StopPlaying()
  71. {
  72.     stereo.backgroundImage  = '';
  73.     wmlogo.visible = true;
  74. }
  75.  
  76.  
  77. function OnPlayStateChange()
  78. {
  79.     if(player.PlayState == psUndefined ||
  80.         player.PlayState == psReady)
  81.     {
  82.         StopPlaying();
  83.     }
  84.     else if (player.PlayState == psPlaying)
  85.     {
  86.         StartPlaying();
  87.     }
  88.     info.value =
  89.         info.tooltip = player.status;
  90. }
  91.  
  92. function OnOpenStateChange()
  93. {
  94.     if(player.OpenState == osMediaOpen)
  95.     {
  96.         UpdateMetadata();
  97.     }
  98. }
  99.  
  100. function UpdateMetadata()
  101. {
  102.     clip.value = player.currentmedia.getiteminfo("title");
  103.     if(clip.value == "")
  104.         clip.value = player.currentmedia.name;
  105.  
  106.     show.value = player.currentplaylist.getiteminfo("title");
  107.     if(show.value == "")
  108.         show.value = player.currentmedia.getiteminfo("Album");
  109.  
  110.     author.value = player.currentmedia.getiteminfo("author");
  111.  
  112.     copyright.value = player.currentmedia.getiteminfo("copyright");
  113. }