hlwhl / webview_cef

WebView for Flutter Desktop Apps using CEF(Chromium Embedded Framework) [Work in Progress]
Apache License 2.0
176 stars 52 forks source link

YouTube crash with OnDidFinishLoad #105

Open alldev opened 8 months ago

alldev commented 8 months ago

Hi,

Recently I faced a problem with webview_cef library and YouTube platform. When loading YouTube (no matter main page, any inner page with video, or even a side server page with embedded video code), app crashes. I reproduce this problem not only in my application, but also on the included example in library package.

Here is the log:

[0124/111943.612038:INFO:CONSOLE(0)] "Error with Permissions-Policy header: Unrecognized feature: 'ch-ua-form-factor'.", source:  (0)
[0124/111946.173676:WARNING:browser_info.cc(298)] Returning a speculative frame for 12884901933 [3,45]
[0124/111951.339047:INFO:CONSOLE(5102)] "LegacyDataMixin will be applied to all legacy elements.
Set `_legacyUndefinedCheck: true` on element class to enable.", source: https://www.youtube.com/s/desktop/c21d783a/jsbin/desktop_polymer.vflset/desktop_polymer.js (5102)
[0124/111951.660313:WARNING:browser_info.cc(298)] Returning a speculative frame for 12884901933 [3,45]
[0124/111951.660456:WARNING:browser_info.cc(298)] Returning a speculative frame for 12884901933 [3,45]
[0124/111951.660498:WARNING:browser_info.cc(298)] Returning a speculative frame for 12884901933 [3,45]
[0124/111951.660532:WARNING:browser_info.cc(298)] Returning a speculative frame for 12884901933 [3,45]
[0124/111951.675898:INFO:CONSOLE(0)] "Error with Permissions-Policy header: Unrecognized feature: 'ch-ua-form-factor'.", source:  (0)
[0124/111951.775891:INFO:CONSOLE(0)] "Error with Permissions-Policy header: Unrecognized feature: 'ch-ua-form-factor'.", source:  (0)
[0124/111953.067548:INFO:CONSOLE(5102)] "LegacyDataMixin will be applied to all legacy elements.
Set `_legacyUndefinedCheck: true` on element class to enable.", source: https://www.youtube.com/s/desktop/c21d783a/jsbin/desktop_polymer.vflset/desktop_polymer.js (5102)
[0124/111953.277697:WARNING:browser_info.cc(298)] Returning a speculative frame for 12884901944 [3,56]
[0124/111958.460758:WARNING:browser_info.cc(298)] Returning a speculative frame for 12884901944 [3,56]
[0124/111958.460962:WARNING:browser_info.cc(298)] Returning a speculative frame for 12884901944 [3,56]
[0124/111958.461036:WARNING:browser_info.cc(298)] Returning a speculative frame for 12884901944 [3,56]
[0124/111958.461100:WARNING:browser_info.cc(298)] Returning a speculative frame for 12884901944 [3,56]
[0124/111958.476178:INFO:CONSOLE(0)] "Error with Permissions-Policy header: Unrecognized feature: 'ch-ua-form-factor'.", source:  (0)
[0124/112004.645292:WARNING:frame_impl.cc(432)] OnDidFinishLoad sent to detached frame 12884901949 [3,61] will be ignored
[0124/112005.141618:WARNING:frame_impl.cc(432)] OnDidFinishLoad sent to detached frame 12884901951 [3,63] will be ignored
Lost connection to device.
Exited

As far as I unerstand there is something on the CEF side what cause unexpected OnDidFinishLoad. Maybe something is missing in compiled CEF itself or library wrapper around it. This problem can refer not only the YouTube platform, but other unexpected (HTML5 video?) cases.

I am on macOS and Jan 15 2024 revision of the library.

Many thanks for your analysis of this case.

SinyimZhi commented 8 months ago

Can reproduce, the repair of Mac issues will be slightly slower。 @alldev

joshiGaming commented 6 months ago

Hey, sorry to bother but are there any updates to this issue.

alterhuman commented 6 months ago

@SinyimZhi any update?

@joshiGaming were you able to find a solution for this?

joshiGaming commented 6 months ago

@alterhuman yeah i did, you need to remove command_line->AppendSwitch("single-process"); in webview_app.h:32 and than add the helpers to your build through xcode so they appear in the app bundle under frameworks.

taenyeon commented 5 months ago

@joshiGaming I don't understand this "add the helpers to your build through xcode so they appear in the app bundle under frameworks." Could you show a relevant example with pictures or files?

chenasraf commented 5 months ago

Removing the single-process set causes crashes the app immediately for me, not sure what needs to be updated in the build process. Any help would be appreciated :)

joshiGaming commented 5 months ago

@taenyeon, of course. You can do it over cmake or directly through Xcode. Navigate to Xcode, select your project's runner, and then proceed to the 'Build Phases' section. Then you add a new phase called "Copy Files Phase".

1

Select under Destination, "Frameworks". Once there, you can easily click on the plus to add new items.

2

Click on "add others" and select all your helper app bundels that were included in the prebuilds.

3

After selecting them, simply click 'Open' followed by 'Finish'. After saving and compiling everything your build should look something like this:

5

Hope that helps :)