Proprietà IWMPNetwork::frameRate

[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à frameRate ottiene la frequenza dei fotogrammi video corrente.

Sintassi

public System.Int32 frameRate {get; set;}

Public ReadOnly Property frameRate As System.Int32

Valore proprietà

System.Int32 che corrisponde alla frequenza dei fotogrammi corrente in fotogrammi per cento secondi.

Nota

Anche se la proprietà encodedFrameRate misura la frequenza dei fotogrammi codificati in fotogrammi al secondo, la proprietà frameRate misura la frequenza dei fotogrammi corrente in fotogrammi per cento secondi. Vedere la sezione Osservazioni.

Commenti

Il valore della frequenza dei fotogrammi corrente viene restituito in fotogrammi per cento secondi. Ad esempio, un valore pari a 2998 indica 29,98 fotogrammi al secondo (fps).

Esempio

Nell'esempio di codice seguente viene utilizzato frameRate per visualizzare la frequenza dei fotogrammi specificata quando il file è stato codificato. Le informazioni vengono visualizzate in un'etichetta in risposta all'evento PlayStateChange . L'oggetto AxWMPLib.AxWindowsMediaPlayer è rappresentato dalla variabile denominata player.

// Add a delegate for the PlayStateChange event.
player.PlayStateChange += new AxWMPLib._WMPOCXEvents_PlayStateChangeEventHandler(player_PlayStateChange);

// Create an event handler for the PlayStateChange event.
private void player_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
{
    // Display the frameRate when the player is playing. 
    switch (e.newState)
    {
        case 3:  // Play State = WMPLib.WMPPlayState.wmppsPlaying = 3
            if (player.network.frameRate != 0)
            {
                frameRateLabel.Text = "Current Frame Rate: " + player.network.frameRate + " K bits/second";
            }
            break;

        default:
            break;
    }
}

' Create an event handler for the PlayStateChange event.
Public Sub player_PlayStateChange(ByVal sender As Object, ByVal e As AxWMPLib._WMPOCXEvents_PlayStateChangeEvent) Handles player.PlayStateChange

    ' Display the frameRate when the player is playing. 
    Select Case e.newState

        Case 3 ' Play State = WMPLib.WMPPlayState.wmppsPlaying = 3

            If (player.network.frameRate <> 0) Then

                frameRateLabel.Text = &quot;Current Frame Rate: &quot; + player.network.frameRate + &quot; K bits/second&quot;

            End If

    End Select

End Sub

Requisiti

Requisito Valore
Versione
Lettore multimediale Windows serie 9 o successive
Spazio dei nomi
WMPLib
Assembly
Interop.WMPLib.dll (Interop.WMPLib.dll.dll)

Vedi anche

Interfaccia IWMPNetwork (VB e C#)

IWMPNetwork.encodedFrameRate (VB e C#)