Cannot play drm-content in chrome.Exception I get is DRM:Failed to create and initialize a mediakeys

2,084 views
Skip to first unread message

manoj swaminathan

unread,
Jul 27, 2016, 11:24:59 PM7/27/16
to Selenium Users
When I use selenium chromedriver to automate a test case where I play drm'ed content, I get this exception "DRM:Failed to create and initialize a mediakeys".

I do not get this exception when I manually open google chrome and navigate to this url https://www.starz.com/play/26525 (with the condition that widevine is listed under chrome://components and under chrome://plugins).

If I close all the chrome instances that are already running and then manually open a new instance of chrome and then I run this test, this time the test method is playing the video.
It looks like there is a problem running widevine component as out-of-process when chrome is initiated through chromedriver, but once this component is loaded by manually initiating a chrome instance, playing drm content is fine.

Please let me know if there is fix for this issue.

Sample code is as below, This test method fails to play the video.

    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void TestMethod1()
        {
            string targetUrl = @"https://www.starz.com/play/26525";
            string driverPath = System.Environment.CurrentDirectory;
            
            ChromeOptions cOptions = new ChromeOptions();

            ChromeDriver testDriver = new ChromeDriver(driverPath, cOptions);
            testDriver.Manage().Window.Maximize();
            testDriver.Navigate().GoToUrl(targetUrl);
            testDriver.Close();
            testDriver.Quit();
        }
    }

Selenium Version: 2.53.1
Browser Version: Google Chrome version 52.0.2743.82 m
OS Version: Win 10
Stack Trace: e…r.PromiseResult {timestamp: "13:31:51:80", title: "CreateMediaKeysCall Promise Result", status: "rejected", result: DOMException: Unable to create the CDM for the key system com.widevine.alpha.}result: DOMException: Unable to create the CDM for the key system com.widevine.alpha.code: 9message: "Unable to create the CDM for the key system com.widevine.alpha."name: "NotSupportedError"__proto__: DOMExceptionstatus: "rejected"timestamp: "13:31:51:80"title: "CreateMediaKeysCall Promise Result"__proto__: Object
bitdashplayer.min.js:1 DRM: Failed to create and initialize a MediaKeys objectf @ bitdashplayer.min.js:1g @ bitdashplayer.min.js:1d @ bitdashplayer.min.js:1n @ bitdashplayer.min.js:1(anonymous function) @ bitdashplayer.min.js:1
VM54:417 e…r.SetMediaKeysCall {timestamp: "13:31:51:91", title: "SetMediaKeysCall", target: e…r.HTMLMediaElement, returned: Promise, mediaKeys: null}mediaKeys: nullreturned: Promisetarget: emeLogger.HTMLMediaElementtimestamp: "13:31:51:91"title: "SetMediaKeysCall"__proto__: emeLogger.EmeMethodCall
vendor-9a873d5b55.min.js:14 [error] Error An error occurred playing MediaId=md:cid:org:bydeluxe.com:332f99a9-c513-4b12-b12d-785b7d648bd3. 3018: DRM: Failed to create and initialize a MediaKeys object(anonymous function) @ vendor-9a873d5b55.min.js:14(anonymous function) @ app.js:4131z @ app.js:24722(anonymous function) @ app.js:22288(anonymous function) @ app.js:5408r @ app.js:5407(anonymous function) @ app.js:5417r.fire @ app.js:5270n @ app.js:5967(anonymous function) @ app.js:5408r @ app.js:5407(anonymous function) @ app.js:5417r.fire @ app.js:5270onError @ app.js:5019(anonymous function) @ vendor-9a873d5b55.min.js:24g @ bitdashplayer.min.js:1d @ bitdashplayer.min.js:1n @ bitdashplayer.min.js:1(anonymous function) @ bitdashplayer.min.js:1
VM54:417 e…r.PromiseResult {timestamp: "13:31:51:97", title: "SetMediaKeysCall Promise Result", status: "resolved"}status: "resolved"timestamp: "13:31:51:97"title: "SetMediaKeysCall Promise Result"__proto__: Object


Reply all
Reply to author
Forward
0 new messages