PlayReady protected video with UWP player and a D3D surface RRS feed

  • Question

  • Hello,

    We are encountering an issue while trying playback of a PlayReady protected MPEG-DASH playlist, and rendering it into a D3D11 texture.
    The goal is to play the video inside a Virtual Reality environment running with Unity engine.

    We are using the following technologies:
    - Windows 10 Desktop environnement (non-UWP)
    - video player uses Windows::Media::Playback::MediaPlayer
    - ID3D11Texture2D created in our code, we are providing it in a ID3D11ShaderResourceView to Unity for using it immediately as a Texture object in our scene
    - video rendering uses an IDirect3DSurface created from the D3D11 texture, in order to being used with UWP player
    - code for initializing PlayReady is based on Windows Universal samples (initially in C#)
    - all implementation points above are in C++/CX

    What currently works:
    - on a standard MPEG-4 file: audio + video works properly
    - clear MPEG-DASH : audio + video works properly
    - MPEG-DASH playlist with PlayReady + CENC: PlayReady initialization and license acquisition works, audio is decrypted and works correctly, but not the video

    Player initialization is done this way:

    m_mediaPlayer = ref new MediaPlayer();
    m_mediaPlayer->AutoPlay = true;
    m_mediaPlayer->IsVideoFrameServerEnabled = true;
    /* ... Creates an AdaptiveMediaSource from MPEG-DASH playlist URL... */
    m_mediaPlayer->Source = MediaSource::CreateFromAdaptiveMediaSource(m_mediaSource);

    Code for creating the texture:

    D3D11_TEXTURE2D_DESC desc;
    ZeroMemory(&desc, sizeof(desc));
    desc.Width = m_mediaPlayer->PlaybackSession->NaturalVideoWidth;
    desc.Height = m_mediaPlayer->PlaybackSession->NaturalVideoHeigh;
    desc.MipLevels = 1;
    desc.ArraySize = 1;
    desc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
    desc.SampleDesc.Count = 1;
    desc.SampleDesc.Quality = 0;
    desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
    desc.MiscFlags = D3D11_RESOURCE_MISC_SHARED;
    desc.Usage = D3D11_USAGE_DEFAULT;
    desc.CPUAccessFlags = 0;
    pd3dDevice->CreateTexture2D(&desc, NULL, &m_internalTexture);

    Code for creating the surface that will receive the video frames during playback:

    IDXGISurface *dxgiSurface;
    m_surface = CreateDirect3DSurface(dxgiSurface);

    PlayReady initialization code:

    m_protectionManager = ref new MediaProtectionManager();
    m_serviceRequestedToken = m_protectionManager->ServiceRequested += ref new ServiceRequestedEventHandler(this, &CMPlayerUWP::OnServiceRequested);
    m_componentLoadFailedToken = m_protectionManager->ComponentLoadFailed += ref new ComponentLoadFailedEventHandler(this, &CMPlayerUWP::OnComponentLoadFailed);
    PropertySet ^cpSystems = ref new PropertySet();
    m_mediaPlayer->ProtectionManager = m_protectionManager;

    We get an error when player tries transferring the video frame to the surface with the documented method:


    We receive an error code 0x80041000 as a result, and the following console trace:

    Exception levée à 0x00007FF8837B5299 (KernelBase.dll) dans TestApp.UWP.exe : 0x40080201: WinRT originate error (paramètres : 0x0000000080041000, 0x0000000000000036, 0x000000D6FF7FE960).
    Exception levée à 0x00007FF8837B5299 dans TestApp.UWP.exe : exception Microsoft C++ : Platform::COMException ^ à l'emplacement de mémoire 0x000000D6FF7FEEB0. HRESULT:0x80041000 Le texte associé à ce code d’erreur est introuvable.

    Is there something specific to initialize for the texture to receive protected content?


    Thursday, April 18, 2019 6:43 AM

All replies

  • Hi,

    After asking other engineer, this problem is out of the scope of UWP forum. You might need ask about this in PlayReady's forum.

    Best regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, April 19, 2019 2:43 AM
  • Hi Roy,

    Thank you for your answer.
    But is there any existing forum for PlayReady? I haven't found any, hence my initial post in UWP.

    I've tried contacting PlayReady team with their licensing email to see if I can get a solution.


    Tuesday, April 23, 2019 4:09 PM