home *** CD-ROM | disk | FTP | other *** search
/ InterCD 2000 July / july_2000.iso / Multimedia / Players / MediaPlayer7 / wmp_preview.exe / classic.wmz / classic.js < prev    next >
Encoding:
JavaScript  |  2000-02-23  |  2.7 KB  |  142 lines

  1. //
  2. //    ⌐2000 Microsoft Corporation. All rights reserved.
  3. //
  4.  
  5. function OnLoad()
  6. {
  7.     OnPlayStateChange();
  8. }
  9.  
  10.  
  11. function FormatString( value )
  12. {
  13.     value = Math.round(value);
  14.  
  15.     var s = '';
  16.     if ((value / 60) < 10)
  17.     {
  18.         s = '0';
  19.     }
  20.     s = s + Math.floor(value / 60);
  21.  
  22.     s = s + ':';
  23.  
  24.     if ((value % 60) < 10)
  25.     {
  26.         s = s + '0';
  27.     }
  28.     s = s + (value % 60);
  29.     return s;
  30. }
  31.  
  32.  
  33. function OnTimerTick()
  34. {
  35.     if (player.PlayState != psUndefined)
  36.     {
  37.         tracktime.value = FormatString(seek.value);
  38.     }
  39. }
  40.  
  41.  
  42. function OnURLChange()
  43. {
  44.     view.title = player.URL;
  45. }
  46.  
  47.  
  48. function StartPlaying()
  49. {
  50.     if (player.currentMedia.ImageSourceHeight == 0)
  51.     {
  52.         icon.backgroundImage="icon_playing.bmp";
  53.  
  54.         view.height = 359 - 183;
  55.     }
  56.     else
  57.     {
  58.         wmlogo.visible = false;
  59.         icon.backgroundImage="icon_video.bmp";
  60.  
  61.         // resize to the video size
  62.  
  63.         var x = player.currentMedia.ImageSourceWidth;
  64.         if (x < 285) 
  65.         {
  66.             x = 285;
  67.         }
  68.         var y = player.currentMedia.ImageSourceHeight;
  69.  
  70.         view.width = x;
  71.         view.height = 359 - 183 + y;
  72.     }
  73.     duration.value = ' / ' + FormatString(seek.max);
  74.     stereo.backgroundImage = 'icon_stereo.bmp';
  75. }
  76.  
  77.  
  78. function StopPlaying()
  79. {
  80.     duration.value          = '';
  81.     tracktime.value         = '';
  82.     icon.backgroundImage    = '';
  83.     stereo.backgroundImage  = '';
  84.     wmlogo.visible = true;
  85. }
  86.  
  87.  
  88. function OnPlayStateChange()
  89. {
  90.     switch (player.PlayState)
  91.     {
  92.     case psUndefined:
  93.         info.value="Closed";
  94.         StopPlaying();
  95.         break;
  96.     case psStopped:
  97.         info.value="Stopped";
  98.         break;
  99.     case psPaused:
  100.         info.value="Paused";
  101.         break;
  102.     case psPlayinging:
  103.         info.value="Playing";
  104.         StartPlaying();
  105.         break;
  106.     case psScanForward:
  107.         info.value="Scanning Forward";
  108.         break;
  109.     case psScanReverse:
  110.         info.value="Scanning Backward";
  111.         break;
  112.     case psBuffering:
  113.         info.value="Buffering...";
  114.         break;
  115.     }
  116.     info.tooltip = info.value;
  117. }
  118.  
  119. function OnOpenStateChange()
  120. {
  121.     switch (player.OpenState)
  122.     {
  123.     case osUndefined:
  124.         break;
  125.     case osMediaOpen:
  126.         clip.value = player.currentmedia.getiteminfo("clip");
  127.         if(clip.value == "")
  128.             clip.value = player.currentmedia.getiteminfo("title");
  129.  
  130.         show.value = player.currentmedia.getiteminfo("show");
  131.         if(show.value == "")
  132.             show.value = player.currentmedia.getiteminfo("WM/AlbumTitle");
  133.  
  134.         author.value = player.currentmedia.getiteminfo("author");
  135.  
  136.         copyright.value = player.currentmedia.getiteminfo("copyright");
  137.  
  138.         
  139.         break;
  140.     }
  141. }
  142.