-- Frequent Requests from the FMXInno Community --
Форматирование (BB-код):
* Users frequently ask how to play videos (locally/web) through WebView2.
* It's not a big deal; it can be done using a simple HTML file and/or just HTML content.
- So, i decided to give you some examples. in the attachment, you'll find
6 examples related to this.
- Here, i've used inline-CSS for styles and ease of use. but you don't have to do it this way; you can have a separate CSS file (Style.css) for this purpose.
- As i mentioned before, you can achieve this in two ways: either by generating an HTML file at runtime or by using HTML content instead of a file. however, there're some limitations with HTML content. with this approach, you may not have the auto-run feature, and you need to do folder mapping for resources. so, i personally prefer generating an HTML file at runtime; it's much easier.
- It's possible to control video playback (pause, resume, stop, etc.) through WebView2 by injecting
JavaScript into the HTML file loaded in the WebView2 control. you can call these JavaScript functions from FMXInno code using the
ExecuteScript method of WebView2.
- Also, you'll find a simple tool (
_TxtToDelphiStr.exe) in the attachment that converts an HTML file to a Delphi/Inno string, saving you time.
- The HTML content in the examples is not exactly the same as the output of '_TxtToDelphiStr.exe' because i've made some necessary changes to make everything work. so, don't get things mixed up.
- I've updated the WebView2 to the
latest version in the FMXInno DLL.
- These examples are only for Windows 10 and Windows 11 as WebView2 requires the '
WebView2 Runtime' to be installed on the system.
- Alternatively, download the WebView2 Runtime manually for unsupported systems.
Download Microsoft WebView2
app.box.com