Integration of Vimeo's video in WPF

2019-07-24 20:51发布

问题:

We have an account on Vimeo where we display some videos for specific viewers. They are privates and we customize the ui's player to disable the share's options. The only thing that the viewer can do it's play the video.

Moreover, we defined a only one specific domain where the videos can be integrated. So we have some webpages on this domain where we integrate the videos.

In a webbrowser like Firefox, Chrome or Edge, if we go on a webpage hosted on this domain, there are no issue to display and play it. But if we use the WPF webbrowser, the webpage can be display with the video, but the Vimeo's player show a message that we can read the video because of privacy settings that we defined.

Why in a browser like Firefox or other, I don't have any issue or message to play the video from a webpage on my domain (what we want) and in the WPF webbrowser, the Vimeo's player don't allow me to play the video on the same webpage in my domain ?

Thank's for help.

回答1:

The WPF WebBrowser control uses the Internet Explorer ActiveX control embedded within its window. So, it has the same limitations as the installed version of Internet Explorer. By default, it will be using IE 7 compatibility so more modern JavaScript may not work quite right.

You can force the control to use a more modern rendering engine either by using a fixed DOCTYPE in the HTML (but obviously, you don't control Vimeo's HTML) or for any launch of your executable on the machine by setting a registry key as described in this Microsoft article: Browser Emulation

You will need to add an entry for your .exe name. For example, if your application is myviewer.exe, it would be something like this to get IE 11 rendering.

HKEY_CURRENT_USER
   SOFTWARE
      Microsoft
         Internet Explorer
            Main
               FeatureControl
                  FEATURE_BROWSER_EMULATION
                     myviewer.exe = (DWORD) 00011000