Silverlight enables a number of online and offline media playback scenarios which can utilize DRM (both WMDRM and PlayReady), from live streaming and progressive download to offline download, rental, and subscription scenarios. In this post I mostly want to highlight a few issues and best practices, but for a more in depth overview of DRM in Silverlight 4, see the DRM Overview in the MSDN Library.
“Silverlight Client Update Required” Error
If Silverlight is revoked, the application is notified that a Silverlight client update is required. Application developers should handle this condition and take appropriate action.
The following scenarios and API can cause a AG_E_DRM_SILVERLIGHT_CLIENT_UPDATE_REQUIRED error to be returned to an application, either directly via an exception or indirectly via either a completion notification or a MediaFailed event.
- Playback (for example, by setting the source on a MediaElement)
- LicenseAcquirer.AcquireLicenseAsync (all overloads)
- IEnumerable<MediaLicense>.* (all public methods/properties, all extension methods)
- IEnumerator<MediaLicense>.* (all public methods/properties, all extension methods)
- LicenseManagement.* (all public methods/properties)
- DomainAcquirer.JoinDomainAsync (all overloads)
- DomainAcquirer.LeaveDomainAsync (all overloads)
Note that while most methods may return this error, not all of them do. For example, no methods or properties on the MediaLicense class can return this error.
Best Practice for Subscription Renewal
When checking if subscription renewal is required, explicitly enumerate the MediaLicenses from the root license instead of enumerating based on the content file.
Completed Event Handler and Asynchronous License Acquisition
If the license acquisition Completed event handler attempts to start an asynchronous license acquisition on the same LicenseAcquirer instance, the LicenseAcquirer instance can be silently garbage collected before the new asynchronous operation completes. For both license acquirers and domain acquirers, this behavior is explicitly blocked with an InvalidOperationException.