gstcefsrc icon indicating copy to clipboard operation
gstcefsrc copied to clipboard

Add javascript signalling

Open aiden-jeffrey opened this issue 6 months ago • 1 comments

Based on this sample, this adds a way to signal in javascript (from the webpage) a couple of things:

  • "ready" - page is ready for rendering, so enable cefsrc to go to a PAUSED/PLAYING state
  • "eos" - page doesn't have any more content, so push an EOS event onto cefsrc

This is useful for pages that have non-trivial load times and may run out of content (webgl pages, pages with videos, etc).

There is a sample in the html/ directory that shows how to send the signals, e.g.:

window.gstSendMsg({
          request: "ready",
          onSuccess: function(response) { ... }
          },
          onFailure: function(error_code, error_message) { ... }
        });
      }

To test, run a webserver in the html directory, say:

python -m http.server 9000

Then just specify the flag in a run pointing at that page:

gst-launch-1.0 -e cefsrc url="http://localhost:9000/ready_test.html" listen-for-js-signals=true ! video/x-raw, width=1920, height=1080, framerate=60/1 ! cefdemux name=d d.video ! queue max-size-bytes=0 max-size-buffers=0 max-size-time=3000000000 ! videoconvert ! xvimagesink

aiden-jeffrey avatar Aug 22 '24 19:08 aiden-jeffrey