Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
If you find these projects useful please consider becoming a sponsor with Patreon, GitHub or Liberapay.

Implementing YouTube's IFRAME player

Post Reply
User avatar
salvadordf
Posts: 4564
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Implementing YouTube's IFRAME player

Post by salvadordf »

bLight wrote: Sat Nov 24, 2018 1:10 pm 2. When Salvador wrote "You will be able to watch most of the YouTube videos but using open source codecs.", does that mean external codecs or codecs that are integrated into CEF? I mean, YouTube currently streams a lot of HD content using VP9 video and Opus audio. Is there a list of codecs supported by CEF?
Chromium doesn't allow you to use external codecs to play multimedia content.
I don't have the complete list of supported codecs but if you build a demo and visit html5test.com you will see this :
  • Video :
    • Ogg Theora support
    • WebM with VP8 support
    • WebM with VP9 support
  • Audio :
    • PCM audio support
    • MP3 support
    • Ogg Vorbis support
    • Ogg Opus support
    • WebM with Vorbis support
    • WebM with Opus support
bLight wrote: Sat Nov 24, 2018 1:10 pm 3. Any other pointers I should consider prior to delving deeper into this project?
I don't have a Delphi 7 license and I can't test the code in that version. Sometimes D7 developers send me bug reports or modified demos and I add them to GitHub. This is the reason why there are only 2 demos for D7.

I would suggest you to use Delphi Community Edition to test all the demos and then adapt what you need to D7.
https://www.embarcadero.com/products/de ... e-download

CEF is not as easy to use as TWebBrowser. It uses multiple processes and the events are executed in a different thread than the main application thread.

You will probably need to use a different EXE for the subprocesses, see the "SubProcess" demo.
User avatar
salvadordf
Posts: 4564
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Implementing YouTube's IFRAME player

Post by salvadordf »

bLight wrote: Sat Nov 24, 2018 3:22 pmDo I need multiple processes if I'm only ever showing 1 page (no tabs)?
I'm afraid so. The single process mode is not supported by CEF3. It causes unexpected errors and it's only useful for debugging.
bLight wrote: Sat Nov 24, 2018 3:22 pmIf I'm forced to use a separate EXE, how can I show the rendered content within my main window? By supplying an HWND?
All the inter-process communication is done automatically by CEF3. The subprocesses communicate with the main process to render the contents without your intervention.

Other things to consider :
  • CEF3 can't be initialized more than once in each process. This means that all plugins or components using CEF3 will have problems if the main application has another plugin that also uses CEF3 or if the main application also uses CEF3 for other purposes.
  • You would need to include the CEF3 binaries and the EXE for the subprocesses (or its source code) with your component.
  • CEF3 should not be initialized while you add code in the main application. Add "if not(csDesigning in ComponentState) then" to the CEF3 initialization.
This might be intimidating at first but you can use most of the code in the "SubProcess" demo. It's a modified version of the "SimpleBrowser" demo but it uses a separate EXE and the uCEFLoader unit to Initialize/Finalize CEF3 automatically.
Post Reply