Recently I tried Netflix, but being a Linux user I realised too late that it would not even work in the Chromium browser.
So I turned around and said: “One moment honey, I just need to recompile my own browser”. And after a quick recompile we could then watch Netflix using the QtWebEngine Demobrowser example.
This was possible because Qt WebEngine 5.7 now supports Netflix and other video on demand services using the same technology. The recompile was necessary because we unfortunately do not support it straight out of the box.
Netflix depends on two things QtWebEngine does not ship with by default: The Widevine CDM plugin and proprietary media codecs enabled.
CDM plugins are what has replaced the Flash plugin in DRM-protected videos, while being an HTML5 standard, it still requires a binary plugin to hide its DRM decryption secrets. So far the dominant CDM plugin is Widevine. Like Flash before it, that means this is the plugin you need to watch DRM-protected videos on the internet. Being a proprietary and binary-only plugin, it is like Flash not something we ship with Qt WebEngine, you will need to get from a third party or from a Google Chrome installation.
Qt WebEngine will try to find an already downloaded or installed version of the plugin, but while convinient this might not be enough if you want to ship an application that relies on it being present. In that case you need to extract from Google Chrome and place it in the application or ‘plugins/ppapi’ folder.
On Linux the Widevine plugin comes with the Google Chrome installation and can be found in “/opt/google/chrome/”, and on some distros such as Arch it also comes as a system package for Chromium and will be under “/usr/lib/chromium/”. The CDM Pepper plugin is named libwidevinecdmadapter.so and depends on libwidevinecdm.so which you can find with it.
On Windows and OS X, Chrome might not ship with all of the plugin on installation and you may need to ask Chrome to download it. You can do this by going to the special url chrome://components and click update on Widevine CDM plugin. On both operating systems Chrome will download the plugin its local application data directory under the user home directory.
On OS X you can then find the plugin under “<homedir>/Library/Application Support/Google/Chrome/WidevineCDM/<version_number>/_platform_specific/mac_x64” as the two files widevinecdmadapter.plugin and widevinecdm.dylib.
On Windows the plugin will be under “<user dir>\AppData\Local\Google\Chrome\User Data\WidevineCDM\<version_number>\_platform_specific\” and then either ‘win_x86’ if you have 32-bit Chrome, or ‘win_x64’ if you have 64-bit Chrome. Here the files are named widevinecdm.dll and widevinecdmadapter.dll. Note that you need to match QtWebEngine and Chrome versions. If you build Qt and QtWebEngine as 64-bit then you need the plugin from 64-bit Chrome.
The second thing you need is proprietary codecs enabled. These are patent protected codecs we do not enable by default. The default build of QtWebEngine only ship with the same codecs as the Chromium browser, and that does not include MP-4 AVC (H.264) which is the most commonly used video codec among video-on-demand providers. To enable proprietary codecs you need to configure and build QtWebEngine with them enabled, for instance by calling qmake like this: “qmake WEBENGINE_CONFIG+=use_proprietary_codecs”. Note this needs to be done for QtWebEngine, enabling it for your own project is not enough.
carewolf@workstation:~/git/qt5/qtwebengine (5.7)$ ../qtbase/bin/qmake WEBENGINE_CONFIG+=use_proprietary_codecs Certificate handling.............. Using system NSS ICU............................... Using internal copy (Default, force system ICU with WEBENGINE_CONFIG+=use_system_icu) FFMPEG............................ Using internal copy (Default, force system FFMPEG with WEBENGINE_CONFIG+=use_system_ffmpeg) Proprietary codecs (H264, MP3).... Enabled Geolocation....................... Enabled
With the Widevine CDM plugin installed and proprietary codecs enabled, everything will just work. Even on other similar services such as German maxdome.de:
Besides HTML5 Video DRM support Qt Webengine 5.7 has many other new features, and is based on a new updated Chromium version. You can find the Qt 5.7 Release Candidate here, so grab the sources today and start writing your own applications for an improved home entertainment experience with your significant others.