View Single Post
  #601  
Old 27-07-2024, 03:46
BLACKFIRE69's Avatar
BLACKFIRE69 BLACKFIRE69 is offline
Registered User
 
Join Date: Mar 2019
Location: In the Hell
Posts: 688
Thanks: 481
Thanked 2,547 Times in 561 Posts
BLACKFIRE69 is on a distinguished road
Arrow FMXInno Community

-- Frequent Requests from the FMXInno Community --


Quote:
* 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.

Quote:
- 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


.
Attached Images
File Type: png 00.png (1.7 KB, 208 views)
File Type: png 00b.png (1.6 KB, 206 views)
File Type: png w1.png (13.3 KB, 207 views)
File Type: png w2.png (20.3 KB, 210 views)
File Type: png w3.png (22.6 KB, 213 views)
File Type: png x1.png (41.3 KB, 213 views)
File Type: png x1b.png (21.1 KB, 207 views)
File Type: png x2.png (86.9 KB, 211 views)
File Type: png x3.png (101.1 KB, 206 views)
Attached Files
File Type: rar FMXInno-WebView2-[Embedded_Video].rar (5.41 MB, 22 views)
Reply With Quote
The Following 5 Users Say Thank You to BLACKFIRE69 For This Useful Post:
audiofeel (27-07-2024), Ele (28-07-2024), Fak Eid (27-07-2024), hitman797 (27-07-2024), ScOOt3r (27-07-2024)
Sponsored Links