Jump to content

video in embedded browser

Recommended Posts

  • Moderators

I can't seem to be able to play video in the embedded browser

The test-code below works fine in any standalone browser, but not in the ide

// video
  var video1 : variant := new JObject;
  video1 := browserapi.document.createElement('video');
  video1.outerHTML := #'
    <video class="div" src="video1.mp4" muted="true" playsinline="true"
     preload="auto" poster="" autoplay="" loop="true" width="' +
     InttoStr(self.width) + '"></video>';

There is link here which refers to disabled codecs in CEF4, would that be the cause ?

It also states that these codecs could be build manually. If so, it might be nice to include them

Link to post
Share on other sites
  • Moderators

The MP4 codecs are only license free in browsers (as long as users don't have to pay for the audio or video). In any other application the use of the most widely used MP4 codecs requires a commercial license.
Looks like that is the reason for the exclusion of mp4 in CEF4

It should be possible to write-your-own MP4 codec. There are a couple of interesting posts on the subject (post 1, post 2) and there is a rudimentary codec structure in the rtl (system.codec.)
However not in the complexity of what mp4 requires

Google has produced its own license free product : 'webm'
This is used in their own products (youtube) and by other main producers (netflix)

There are many online converters available to convert .mp4 files to .webm files

Using the TW3MediaPlayer component (smartcl.controls.mediaplayer) to see how that works :

procedure TForm1.InitializeForm;
  VPlayer : TW3MediaPlayer;
  // this is a good place to initialize components

  VPlayer := TW3MediaPlayer.Create(self);

  if VPlayer.CanPlayType('video/webm','vp8, vp9') = msProbably then
  if VPlayer.CanPlayType('video/webm','vp8, vp9') = msMaybe then
  if VPlayer.CanPlayType('video/webm','vp8, vp9') = msNo then

  VPlayer.Load('video1.webm');  //video1.mp4');

  var Button1 := TW3Button.Create(self);
  Button1.Caption := 'Play';
  Button1.OnClick := lambda VPlayer.Play; end;


And indeed this plays videos in both standalone browsers and the ide




Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...