How can I do some changes in LC engine and test them?

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, LCMark

Post Reply
Monox18
Posts: 83
Joined: Tue Nov 25, 2014 9:48 pm
Location: Deggendorf, Germany

How can I do some changes in LC engine and test them?

Post by Monox18 » Mon Jan 04, 2021 12:51 am

I want to modify how the browser widget call the CEF browser implementation. I took a look into LC source in github and found the file that I want to edit which is this: https://github.com/livecode/livecode/bl ... rowser.cpp

Once I modify it, how do I incorporate/compile/run that file? I searched that file in my Windows installation of LC. But I didn't find it. Do I need to compile the engine? or can I just edit that file and replace something locally in my machine?

The lines which I want to modify are:

Code: Select all

	CefMainArgs t_args;
	CefSettings t_settings;
	t_settings.multi_threaded_message_loop = false;
	t_settings.command_line_args_disabled = true;
	t_settings.no_sandbox = true;
	t_settings.log_severity = LOGSEVERITY_VERBOSE;
t_args contains the arguments (flags) that initialize the CEF browser and t_settings contains some of the settings utilized. LC doesn't provide a method to change them. They are hardcoded.

The problem that I'm facing is that currently the browser widget can't access the GetUserMedia() JavaScript method because the CEF browser requires the --enable-media-stream flag to enable the WebRTC features and thus allow the GetUserMedia to access the webcam and microphone.

From the CEF forum I have found how to add flags. I really don't know C++ but I'm praying adding this line will enable WebRTC:

Code: Select all

t_settings.CefCommandLineArgs.Add("enable-media-stream", "1");
Also, CEF contains a whole ton of flags and settings to play around. By implementing a method that allows to change them, one would give LC a massive boost integration with the CEF capabilites, thus a more solid HTML5 implementation in native apps.

Thank you!
Monox
Developing a Cyber Physical System.
https://www.monoxware.com/

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3202
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: How can I do some changes in LC engine and test them?

Post by mwieder » Mon Jan 04, 2021 3:14 am

Yes, you'll need to compile the system locally and launch the newly-compiled engine to test any changes.
Been a while since I've had to do this on Windows, but the instructions are at

https://github.com/livecode/livecode/bl ... ild-win.md

...and thanks in advance for any CEF modifications you can make.

Monox18
Posts: 83
Joined: Tue Nov 25, 2014 9:48 pm
Location: Deggendorf, Germany

Re: How can I do some changes in LC engine and test them?

Post by Monox18 » Mon Jan 04, 2021 11:57 am

Just what I was fearing, I have to follow a long process in order to compile the engine and play around with the browser widget. Alright, thank you for pointing me in the right direction. Will report back the results.
Monox
Developing a Cyber Physical System.
https://www.monoxware.com/

Monox18
Posts: 83
Joined: Tue Nov 25, 2014 9:48 pm
Location: Deggendorf, Germany

Re: How can I do some changes in LC engine and test them?

Post by Monox18 » Mon Jan 04, 2021 2:31 pm

I installed all the dependencies, including updates, and followed Windows guide in LC github. After cloning LC, when I double click the configure.bat file I get an error. Apparently 2 files are missing:
Image

Any recommendation? No idea what I am missing.
Monox
Developing a Cyber Physical System.
https://www.monoxware.com/

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3202
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: How can I do some changes in LC engine and test them?

Post by mwieder » Tue Jan 05, 2021 1:54 am

I found some notes that Trevor typed up a couple of years ago.

https://www.bluemangolearning.com/livec ... community/

Monox18
Posts: 83
Joined: Tue Nov 25, 2014 9:48 pm
Location: Deggendorf, Germany

Re: How can I do some changes in LC engine and test them?

Post by Monox18 » Tue Jan 05, 2021 6:14 pm

Actually It was doing what it is supposed to do. It wasn't an error, just a warning. It mentions two missing input files. So I proceed.

The configure.bat files does create the folder build-win-x86_64 containing the Visual Studio files to compile it. That file detects my PC's arquitecture and automatically choses -x86_64 rather than the x32 as shown in the github instructions. I opened Visual studio 2017, followed the final steps and build it. The built was successful.

Then I can see the file "LiveCode-Community.exe" in the "build-win-x86_64\livecode\Debug\" folder and although it runs the IDE 9.7 (dp 1) it runs extremely slowly. Like very buggy. Doesn't respond well to user actions. takes minutes to load. Can't open properly my other stacks. Can't drag widgets from the palette. Even created 2 buttons and created the browser widget from code. Setting its URL does nothing.... (And I haven't done any changes in the engine source code yet).

This compiled engine doesn't work well in my machine. I guess this is as far as I can go.
Monox
Developing a Cyber Physical System.
https://www.monoxware.com/

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3202
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: How can I do some changes in LC engine and test them?

Post by mwieder » Tue Jan 05, 2021 9:27 pm

Hmmm... grasping at straws here, but the IDE will load very slowly at first because it's creating the entire dictionary for you. I don't know if there is a flag to get around that, but if you're launching from the command line you'll see a lot of thrashing around building the files.

Monox18
Posts: 83
Joined: Tue Nov 25, 2014 9:48 pm
Location: Deggendorf, Germany

Re: How can I do some changes in LC engine and test them?

Post by Monox18 » Tue Jan 19, 2021 4:23 pm

Thank you mwieder for the tips.

Long story short. I reached out LC support and they helped me. I was indeed successfully compiling the LC engine but the browser widget never worked. So I couldn't do it myself, but the good news is that Panos quickly fixed the original WebRTC issue. Hopefully my bug report and suggestions helped. WebRTC support for CEF browser will hopefully appear in the next LC release (9.6.3 RC-1).

Bug report. The last comment includes the Pull Request in Github where you can what lines of code were changed:
https://quality.livecode.com/show_bug.cgi?id=23030

It's worth mentioning that the flags and options supported by the CEF browser is quite extensive. There are other things that are currently unavailable in the browser widget for the same reason. Enabling the flag would enable the functionality in LC. As simple as that. But I suppose there must be some cons of that. Mostly performance issues. The folks at the CEF forums would provide more insight there.

So enabling a lot of flags hardcoded in the engine is not the best idea. Maybe implementing a method where the user can selectively pick flags would be better. But that's food for another day. All I want now is to see that damn WebRTC working in LC in the next release!.
Monox
Developing a Cyber Physical System.
https://www.monoxware.com/

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3202
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: How can I do some changes in LC engine and test them?

Post by mwieder » Tue Jan 19, 2021 5:51 pm

Great.

Without going into a *lot* of history and details, LC is using the CEF browser in a way that's probably unique to us: other folks embed their code inside the CEF code so that the browser invokes it. LC is using the browser as an adjunct, embedding the CEF browser in the main code of the LC ecosystem. That pretty much precludes implementing passing commandline options to the browser. If CEF is still the way of the future for embedding browser code in the engine it's not clear to me how optional compile-time flags might be implemented.

Monox18
Posts: 83
Joined: Tue Nov 25, 2014 9:48 pm
Location: Deggendorf, Germany

Re: How can I do some changes in LC engine and test them?

Post by Monox18 » Wed Jan 20, 2021 7:24 pm

Those are some interesting details. I really have zero knowledge about that. I didn't even know about CEF until I came to this WebRTC issue. Anyway I see a lot of potential in CEF and for sure is still the way of future embedding. Only Mac is using the OS browser, while Windows, Android and Linux use the CEF. Not sure about iPhones and naturally a browser is not needed when deploying to HTML5. CEF browser is what makes LiveCode a Hybrid, a native executable with embedded HTML5 capabilities. Since it wouldn't be optimal to support compile-time flags then we really need to be selective in which flags to allow by default. Will keep this in mind.
Monox
Developing a Cyber Physical System.
https://www.monoxware.com/

Post Reply

Return to “Engine Contributors”