Updating Licenses

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

Online stores can deliver content that is licensed for a specific period of time or until a certain date. This would be normal for music content delivered as part of a subscription service agreement. In this case, the online store needs an opportunity to update these licenses before they expire, assuming, of course, that the user has paid to renew his or her subscription. (If the user has not renewed the subscription, the licenses can simply be left to expire.)

Windows Media Player queries the content partner plug-in about how much advance warning the Player should provide about a license that is about to expire. It does this by calling IWMPContentPartner::GetContentPartnerInfo, passing the constant g_szContentPartnerInfo_LicenseRefreshAdvanceWarning through the bstrInfoName parameter. To alert the plug-in about licenses that are about to expire, Windows Media Player calls IWMPContentPartner::RefreshLicense. This call takes parameters that provide details about the file being refreshed, such as whether the file is on the user's computer, and the path to the file. If the license is being refreshed as part of a device synchronization operation, the pReasonContext parameter supplies the cannonical name of the device

When Windows Media Player calls RefreshLicence, it passes a cookie that identifies the update request. When the plug-in has finished processing the update request, it notifies Windows Media Player by calling IWMPContentPartnerCallback::RefreshLicenseComplete, passing the cookie, the ID of the media item, and an HRESULT that indicates whether the update was successful.

Online store plug-ins can also do license inspection and updates as a background process. Windows Media Player notifies the plug-in about times when it is permissible to perform background processing tasks by calling IWMPContentPartner::Notify. To signal the plug-in to start background processing, the Player passes the WMPPartnerNotification enumeration value wmpsnBackgroundProcessingBegin; to signal the plug-in to stop background processing, the Player passes the value wmpsnBackgroundProcessingEnd.

Programming Guide for Type 1 Online Stores