delphi下调用dcef支持flash与MP4播放

1、https://github.com/hgourvest/dcef3/tree/2454

    从github下载2454的版本dcef,原因是后面提供的支持库只支持这个版本的dcef编译出来的程序

2、安装下载下来的dcef3-2454\packages当中的控件

      引用dcef3-2454\src其中的单元

3、在program guiclient;文件当中添加如下的红字部分

procedure RegisterSchemes(const registrar: ICefSchemeRegistrar);
begin
registrar.AddCustomScheme('local', True, True, False);
end;

procedure BeforeCommandLineProcessing(const processType: ustring; const commandLine: ICefCommandLine);
begin
commandLine.AppendSwitchWithValue('--ppapi-flash-path', ExtractFilePath(ParamStr(0)) + 'PepperFlash\pepflashplayer.dll');    //对应的flash控件
commandLine.AppendSwitchWithValue('--ppapi-flash-version', '21.0.0.242');    //对应的版本号
commandLine.AppendSwitch('--enable-media-stream');
commandLine.AppendSwitch('--enable-usermedia-screen-capturing');
end;

begin
CefCache := 'cache';
CefOnRegisterCustomSchemes := RegisterSchemes;
CefOnBeforeCommandLineProcessing := BeforeCommandLineProcessing;
CefSingleProcess := False;
if not CefLoadLibDefault then
Exit;

CefRegisterSchemeHandlerFactory('local', '', TFileScheme);

Application.Initialize;
Application.CreateForm(TMainForm, MainForm);
Application.Run;
end.

4、编译生成程序,生成的程序放到下面提供的文件当中即可

     链接: https://pan.baidu.com/s/1dFRpNJb 密码: vj1y

posted @ 2018-02-27 18:32  西瓜大  阅读(1883)  评论(0)    收藏  举报