Media.imageSourceWidth

[La funzionalità associata a questa pagina, Lettore multimediale Windows SDK, è una funzionalità legacy. È stato sostituito da MediaPlayer. MediaPlayer è stato ottimizzato per Windows 10 e Windows 11. Microsoft consiglia vivamente che il nuovo codice usi MediaPlayer invece di Lettore multimediale Windows SDK, quando possibile. Microsoft suggerisce che il codice esistente che usa le API legacy venga riscritto per usare le nuove API, se possibile.

La proprietà imageSourceWidth recupera la larghezza dell'elemento multimediale corrente in pixel.

Sintassi

giocatore. currentMedia. imageSourceWidth

Valori possibili

Questa proprietà è un valore Number di sola lettura (long).

Commenti

Se l'elemento multimediale non è quello corrente, questa proprietà restituisce zero.

Per recuperare il valore di questa proprietà, è necessario l'accesso in lettura alla libreria. Per altre informazioni, vedere Accesso alla libreria.

Esempio

Nell'esempio JScript seguente viene usato Media. imageSourceWidth per visualizzare le dimensioni dell'immagine, in pixel, dell'elemento multimediale corrente. Le informazioni vengono stampate in un elemento HTML TEXTAREA denominato VideoSize. L'oggetto Player è stato creato con ID = "player".

<!-- Create an event handler to refresh the information when the current media changes. -->
<SCRIPT LANGUAGE = "JScript"  FOR = "Player"  EVENT = OpenStateChange(NewState)>

// Test whether the new media item is open.
if (NewState == 13){

   // Store the height and width of the new media item.
   var Height = Player.currentMedia.imageSourceHeight;
   var Width =  Player.currentMedia.imageSourceWidth;

   // Erase the information in the text area.
   VideoSize.value = "";

   // Test whether an image is visible.
   if (Height != 0 && Width != 0)

      // Display the image size information.
      VideoSize.value = Width + " x " + Height;
}
</SCRIPT>

Requisiti

Requisito Valore
Versione
Lettore multimediale Windows versione 7.0 o successiva.
DLL
Wmp.dll

Vedi anche

Oggetto Media

Player.currentMedia

Settings.mediaAccessRights

Settings.requestMediaAccessRights