nomi-san/cefau3

Flash player

ibrahemesam opened this issue · 13 comments

How can I enable flash player in CEF au3

Hi,

First, you need sync cefau3 source and rebuild it (or put autoit3/cefau3/* & release/cefau3.dll to your program).

  1. Implement OnBeforeCommandLineProcessing from CefApp
$cef_app.OnBeforeCommandLineProcessing = __OBCLP

func __OBCLP($process_type, $command_line)

end
  1. Enable plugins support via CefBrowserSettings
$browser_settings.plugins = 1
$browser_settings.webgl = 1 ; enable webGL
  1. Setup flash player
  • Download flash plugin library (.dll), click here or search pepflashplayer.dll on Google. For exmaple, I download pepflashplayer.dll (32bit - v23.0.0.162) and put it in C:\pepflashplayer.dll.
  • On __OBCLP function, add following code:
    ...
    $command_line.AppendSwitch(' --enable-system-flash=1 ')
    $command_line.AppendSwitchWithValue('ppapi-flash-path', 'C:\\pepflashplayer.dll')
    $command_line.AppendSwitchWithValue('ppapi-flash-version', '23.0.0.162')
    $command_line.AppendSwitchWithValue('plugin-policy', 'allow')

sorry for my late

I did as you say

`$cef_app.OnBeforeCommandLineProcessing = __OBCLP
$browser_settings.plugins = 1
$browser_settings.webgl = 1 ; enable webGL

func __OBCLP($process_type, $command_line)
$command_line.AppendSwitch(' --enable-system-flash=1 ')
$command_line.AppendSwitchWithValue('ppapi-flash-path', @ScriptDir '\pepflashplayer.dll')
$command_line.AppendSwitchWithValue('ppapi-flash-version', '28.0.0.137')
$command_line.AppendSwitchWithValue('plugin-policy', 'allow')
EndFunc `

, but the script stops here
image

I think $browser_settings is not declared or it is not an object, so you cannot invoke dispatch.

global $browser_settings = $cef.new("BrowserSettings")

You can see that.

https://github.com/wy3/cefau3/blob/cdc6b196840cd857d62c625be10de344045632f6/autoit3/cefau3/cefau3.au3#L157-L161

it gives an error on another file
image

Are you using the latest Cefau3 version?
The previous version is not supported pre-commandline processing.

First, you need sync cefau3 source and rebuild it (or put autoit3/cefau3/* & release/cefau3.dll to your program).

Yes

My program folder contains :
cefau3 (folder)
cefau3.dll (file)
The script.au3 (file)

is that right ?

Please check two files $(repo)/release/ cefau3.dll and your cefau3.dll.
Is it one?

btw
AutoIt bindings is my failure, that is so low and bad performance, I cannot continue to develop this project. I'm so sorry about that.

yes,it is

image
image

please, if you want to make new version,don't forget to add flash player to it

Okay, please try my binaries here (only for x86, I tested on Windows 7 and 10 32bit & 64bit).

In your code, $browser_settings is not linked to app, so you cannot enable flashplayer (if it works).
If this code is from example.au3, you can see $cef.CreateBrowser, at #param4, that is BrowserSettings.

#Region init flash player
$cef_app.OnBeforeCommandLineProcessing = __OBCLP
$cef_bs.plugins = 1
$cef_bs.webgl = 1 ; enable webGL

func __OBCLP($process_type, $command_line)
	$command_line.AppendSwitch(' --enable-system-flash=1 ')
    $command_line.AppendSwitchWithValue('ppapi-flash-path', @ScriptDir & '\pepflashplayer.dll')
    $command_line.AppendSwitchWithValue('ppapi-flash-version', '25.0.0.171')
    $command_line.AppendSwitchWithValue('plugin-policy', 'allow')
endfunc
#EndRegion

global $url = 'https://www.google.com/'
$cef.CreateBrowser($cef_wininfo.__ptr, $cef_client.__ptr, $url, $cef_bs.__ptr, Null)

global $cef_browser_hwnd = 0

OnAutoItExitRegister('CefExit')

CefWndMsg_RunLoop(0)

still not working
image

Cefau3 is not stable, and flash is a third party, it maybe crash. You must run example on compiled executable.

Please try this.

$cef_app.OnBeforeCommandLineProcessing = __OBCLP ; set commandline processing before init app
$cef.Initialize(...) ; /////////////////////
...
#Region init flash player
$cef_bs.plugins = 1
$cef_bs.webgl = 1 ; enable webGL

func __OBCLP($process_type, $command_line)
    $command_line = CefCommandLine_Create($command_line) ; create commandline object
    $command_line.AppendSwitch(' --type=ppapi --enable-system-flash=1 ')
    $command_line.AppendSwitchWithValue('ppapi-flash-path', 'C:\pepflashplayer.dll')
    $command_line.AppendSwitchWithValue('ppapi-flash-version', '25.0.0.171')
    $command_line.AppendSwitchWithValue('plugin-policy', 'allow')
endfunc
#EndRegion
...
global $url = 'https://google.com'
$cef.CreateBrowser($cef_wininfo.__ptr, $cef_client.__ptr, $url, $cef_bs.__ptr, Null)
...

what should I put here ?
image

This line is from example, $cef_app.OnBeforeCommandLineProcessing must be set above this line.