vendredi 10 février 2017

C# CefSharp enables flash play local mp4 video

My app contains a chrome web browser that plays mp4 file. I have a problem is the app uses flash to play mp4 file, but It's only working with remote mp4 file, not local mp4 file. This is my code:

this.m_appPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\";
string url = (new Uri(this.m_appPath + "modules\\player\\chromePlayer.html", UriKind.Absolute)).AbsoluteUri;
var settings = new CefSettings();
settings.CefCommandLineArgs.Add("debug-plugin-loading", "1");
settings.CefCommandLineArgs.Add("allow-outdated-plugins", "1");
settings.CefCommandLineArgs.Add("always-authorize-plugins", "1");
settings.CefCommandLineArgs.Add("disable-web-security", "1");
settings.CefCommandLineArgs.Add("enable-npapi", "1");
settings.CefCommandLineArgs.Remove("enable-system-flash");
settings.CefCommandLineArgs.Add("enable-system-flash", "1");
Cef.Initialize(settings);
mainWebBrowser = new ChromiumWebBrowser(url);
mainWebBrowser.BrowserSettings.FileAccessFromFileUrls = CefState.Enabled;
mainWebBrowser.BrowserSettings.UniversalAccessFromFileUrls = CefState.Enabled;
mainWebBrowser.BrowserSettings.WebSecurity = CefState.Disabled;
mainWebBrowser.BringToFront();

I think that it has some security problem. So I coded an AS3 script to play local mp4 file, it works fine on Firefox, but not working on chrome.

It maybe that i need to change some settings but i don't know how to do it. Please help me. thanks.

Sorry about my English.

Aucun commentaire:

Enregistrer un commentaire