Compartilhar via


MFP_ACQUIRE_USER_CREDENTIAL_EVENT structure (mfplay.h)

[The feature associated with this page, MFPlay, is a legacy feature. It has been superseded by MediaPlayer and IMFMediaEngine. Those features have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer and IMFMediaEngine instead of DirectShow, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

Event structure for the MFP_EVENT_TYPE_ACQUIRE_USER_CREDENTIAL event. This event is sent if the application plays a media file from a server that requires authentication. The application can respond by providing the user credentials.

Syntax

typedef struct MFP_ACQUIRE_USER_CREDENTIAL_EVENT {
  MFP_EVENT_HEADER     header;
  DWORD_PTR            dwUserData;
  BOOL                 fProceedWithAuthentication;
  HRESULT              hrAuthenticationStatus;
  LPCWSTR              pwszURL;
  LPCWSTR              pwszSite;
  LPCWSTR              pwszRealm;
  LPCWSTR              pwszPackage;
  LONG                 nRetries;
  MFP_CREDENTIAL_FLAGS flags;
  IMFNetCredential     *pCredential;
} MFP_ACQUIRE_USER_CREDENTIAL_EVENT;

Members

header

MFP_EVENT_HEADER structure that contains data common to all IMFPMediaPlayer events.

dwUserData

Application-defined user data for the media item. This value is specified when the application calls IMFPMediaPlayer::CreateMediaItemFromURL or IMFPMediaPlayer::CreateMediaItemFromObject to create the media item.

This event is sent (if at all) before the media item is created and before the application receives the MFP_EVENT_TYPE_MEDIAITEM_CREATED event. You can use the value of dwUserData to identify which media item requires authentication.

fProceedWithAuthentication

The application should set this member to either TRUE or FALSE before returning from the IMFPMediaPlayerCallback::OnMediaPlayerEvent event callback.

If the value is TRUE when the callback returns, MFPlay continues the authentication attempt. Otherwise, authentication fails.

hrAuthenticationStatus

The response code of the authentication challenge.

pwszURL

The original URL that requires authentication.

pwszSite

The name of the site or proxy that requires authentication.

pwszRealm

The name of the realm for this authentication.

pwszPackage

The name of the authentication package, such as "Digest" or "MBS_BASIC".

nRetries

The number of retries. This member is set to zero on the first attempt, and incremented once for each subsequent attempt.

flags

Bitwise OR of zero or more flags from the _MFP_CREDENTIAL_FLAGS enumeration.

pCredential

Pointer to the IMFNetCredential interface. The application uses this interface to set the user's credentials.

Remarks

To get a pointer to this structure, cast the pEventHeader parameter of the IMFPMediaPlayerCallback::OnMediaPlayerEvent callback method. You can use the MFP_GET_ACQUIRE_USER_CREDENTIAL_EVENT macro for this purpose.

If the flags member contains the MFP_CREDENTIAL_PROMPT flag, the application should do the following:

  1. Prompt the user to enter a user name and password.
  2. Store the user name in the credentials object by calling IMFNetCredential::SetUser on the pCredential pointer.
  3. Store the password by calling IMFNetCredential::SetPassword on the pCredential pointer.
To cancel authentication, set fProceedWithAuthentication equal to FALSE.

By default, MFPlay uses the network source's implementation of IMFNetCredentialManager to manage credentials. An application can provide its own implementation of this interface as follows:

  1. Call QueryInterface on the IMFPMediaPlayer pointer to get the IPropertyStore interface.
  2. Call IPropertyStore::SetValue to set the MFNETSOURCE_CREDENTIAL_MANAGER property.

Requirements

Requirement Value
Minimum supported client Windows 7 [desktop apps only]
Minimum supported server Windows Server 2008 R2 [desktop apps only]
Header mfplay.h

See also

IMFPMediaPlayerCallback

Media Foundation Structures

Using MFPlay for Audio/Video Playback