CefSharp播放flash

原生CefSharp組件缺少Flash Player,實現內置瀏覽器功能時,不支持播放flash。若想使用flash播放功能,我們需要在初始化CefSharp組件時,加載flash播放插件,並設置支持flash播放。
Chrome瀏覽器內核的flash插件文件爲pepflashplayer.dll,將pepflashplayer.dll文件放在程序運行目錄下,加載flash插件的C#代碼如下:

var setting = new CefSharp.CefSettings();
setting.Locale = "zh-Cn";
setting.CefCommandLineArgs.Add("enable-system-flash", "1"); //啓用flash
setting.CefCommandLineArgs.Add("enable-media-stream", "1"); //啓用媒體流
setting.CefCommandLineArgs.Add("ppapi-flash-version", "25.0.0.171"); //設置flash插件版本
//使用指定的flash插件,不使用系統安裝的flash版本
setting.CefCommandLineArgs.Add("ppapi-flash-path", AppDomain.CurrentDomain.BaseDirectory + "pepflashplayer.dll"); 

若使用Chrome官方插件最新版本的pepflashplayer.dll插件,打開帶flash的網站後,播放flash,可能出現"This Flash Player is not compatible with your region"的提示,說明該插件不支持在本地區(中國)使用,建議從其他軟件中找一個pepflashplayer.dll插件使用,如迅雷、微信、QQ等。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章