How to handle playready in MediaEngine with C++


  • Hi: All

    I want to use Media Engine to play the DRM contents,

    According to the playready sample of Java script,

    I use the MediaProtectionManager I use the class as the protection manager of the Media Engine

    These is my codes:

    void MEPlayer::componentLoadFailed(MediaProtectionManager^ sender, ComponentLoadFailedEventArgs^ e)
    void MEPlayer::serviceRequested(MediaProtectionManager^ sender, ServiceRequestedEventArgs^ e)
    void MEPlayer::Initialize()
    	MediaProtectionManager ^mediaProtectionManager = ref new MediaProtectionManager();
    	mediaProtectionManager->ComponentLoadFailed += ref new ComponentLoadFailedEventHandler(this, &MEPlayer::test);
    	mediaProtectionManager->ServiceRequested += ref new ServiceRequestedEventHandler(this, &MEPlayer::test2);
    	MFCreateAttributes(&spAttributes, 1)
        spAttributes->SetUnknown(MF_MEDIA_ENGINE_CONTENT_PROTECTION_MANAGER, (IUnknown*) mediaProtectionManager);
    	spFactory->CreateInstance(flags, spAttributes.Get(), &m_spMediaEngine);

    I have installed the Microsoft.Media.PlayReadyClient.vsix and call these codes in my app

    _extensions->RegisterByteStreamHandler("Microsoft.Media.PlayReadyClient.PlayReadyByteStreamHandler", ".pyv", "video/pyv");

    _extensions->RegisterByteStreamHandler("Microsoft.Media.PlayReadyClient.PlayReadyByteStreamHandler", ".pya", "audio/pya");

    While running, the Media Engine notify MEDIA_ENGINE_ERR_SRC_NOT_SUPPORTED , the functions componentLoadFailed() and serviceRequested() were not called .

    Where is the problem?


    Wednesday, March 14, 2012 11:48 AM

All replies

  • Hello Pitt,

    The MEDIA_ENGINE_ERR_SRC_NOT_SUPPORTED error that you are seeing is generic and does not necessarily mean that you are having an issue with play ready. First I would recommend that you verify the source of your PlayReady encoded file. Keep in mind that if you file source is in your local network you need to add that capability. If your PlayReady server is in your local network you need to add the same capability. Here is what I would suggest to help you debug your application. Make sure that you can play an unprotected file recorded in the same format as you PR file. Once you are satisfied that you can play unprotected files, use the Silverlight MediaElement to verify that you can receive a license and can playback the protected file. I would recommend that you use a persistent license. Once you know that you have a license for the content on your development machine and have verified that you can play the file using Silverlight, try playing the same file in your Metro style app. If the file plays you know that you are having a license acquisition issue. A quick netmon trace during the license acquisition can help to sort out what is happening. If you are still having problems after completing this testing please let me know and I will do what I can to help.



    Windows Media SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    Wednesday, March 14, 2012 9:53 PM
  • I just spent the last hour discovering that PlayReady does not work when running your app over remote desktop -- which makes sense, but it just didn't occur to me right way. Anyway, I'm just posting here to let other devs know in case they run into this too... hoping it will save some headaches.

    Cheers, Tim

    Thursday, March 15, 2012 1:56 AM
  • Hi: James

    Thanks for your reply, By now , the playready client can work in my Media engine sample for audio files from the Microsoft Playready test server "http://playready.directtaps.net/pr/public/",

    But the video test files from the test server can not playback in my test sample, such as the file "http://playready.directtaps.net/pr/public/media/1044/Bear_Video_OPLs0.pyv" , the Media Engine notify MEDIA_ENGINE_ERR_SRC_NOT_SUPPORTED , and The Playready Jscript sample can play this file, I have checked the file source, it is a wmv file, and My test sample can play this file.

    Before the the Media Engine notify MEDIA_ENGINE_ERR_SRC_NOT_SUPPORTED, My callback function "serviceRequested()" for playready  can be called and work well , It seems the DRM video source can not be accepted by the Media Engine. I could not find the problem.

    Wednesday, March 21, 2012 3:43 AM
  • seems it's because  Windows.Media.ContentProtection.VideoFrameAccessCertificate  property doesn't been set to MediaProtectionManager.

    so audio can play, but video failed.

    as hint from other discussions on windows 7 desktop OPM related items,  seems  need get drivers' public key,  and then encrypt and set to media protection manager.

    can anybody confirm if this guess is right or not?

    if somebody can tell us how to get graphic drivers' public key,  it will be very appreciated.  

    if this information should not be open to public,  please point to us as well,  thank you very much.

    once more,  if this information is not public,  can somebody give us a hint where we can get help from?


    ---------------------------------------------- JohnYe from SHANGHAI. email: yechzh@126.com

    Friday, April 6, 2012 11:35 AM
  • Looks like that I have the same problem that you had. I can play audio but not video. Did you found out how to solve that? I have searched a lot and I couldn't figure out how to solve it.

    Did you get the UINT 8 matrix for the Windows.Media.ContentProtection.VideoFrameAccessCertificate ?
    Thursday, October 4, 2012 6:23 PM