# wpevideosrc

The wpevideosrc element is used to produce a video texture representing a web page rendered off-screen by WPE.

Starting from WPEBackend-FDO 1.6.x, software rendering support is available. This features allows wpevideosrc to be used on machines without GPU, and/or for testing purpose. To enable it, set the `LIBGL_ALWAYS_SOFTWARE=true` environment variable and make sure `video/x-raw, format=BGRA` caps are negotiated by the wpevideosrc element.

As the webview loading is usually not instantaneous, the wpevideosrc element emits messages indicating the load progress, in percent. The value is an estimate based on the total number of bytes expected to be received for a document, including all its possible subresources and child documents. The application can handle these `element` messages synchronously for instance, in order to display a progress bar or other visual load indicator. The load percent value is stored in the message structure as a double value named `estimated-load-progress` and the structure name is `wpe-stats`.

## Example launch lines

    gst-launch-1.0 -v wpevideosrc location="https://gstreamer.freedesktop.org" ! queue ! glimagesink

Shows the GStreamer website homepage

    LIBGL_ALWAYS_SOFTWARE=true gst-launch-1.0 -v wpevideosrc num-buffers=50 location="https://gstreamer.freedesktop.org" \
      videoconvert ! pngenc ! multifilesink location=/tmp/snapshot-%05d.png

Saves the first 50 video frames generated for the GStreamer website as PNG files in /tmp.

    gst-play-1.0 --videosink gtkglsink web+https://gstreamer.freedesktop.org

Shows the GStreamer website homepage as played with GstPlayer in a GTK+ window.

    gst-launch-1.0  glvideomixer name=m sink_1::zorder=0 ! glimagesink wpevideosrc location="file:///tmp/asset.html" draw-background=0 \
      ! m. videotestsrc ! queue ! glupload ! glcolorconvert ! m.

Composite WPE with a video stream in a single OpenGL scene.

    gst-launch-1.0 glvideomixer name=m sink_1::zorder=0 sink_0::height=818 sink_0::width=1920 ! gtkglsink \
       wpevideosrc location="file:///tmp/asset.html" draw-background=0 ! m.
       uridecodebin uri="http://example.com/Sintel.2010.1080p.mkv" name=d d. ! queue ! glupload ! glcolorconvert ! m.

Composite WPE with a video stream, sink_0 pad properties have to match the video dimensions.

    weston -S $HOME/weston-sock -B headless-backend.so --use-gl &
    WAYLAND_DISPLAY=$HOME/weston-sock gst-launch-1.0 wpevideosrc location=https://google.com ! queue ! fakevideosink

Render Google.com with WPE in a headless Weston compositor. This can be useful for server-side WPE video processing.

## Hierarchy

    GObject
        ╰──GInitiallyUnowned
            ╰──GstObject
                ╰──GstElement
                    ╰──GstBaseSrc
                        ╰──GstPushSrc
                            ╰──GstGLBaseSrc
                                ╰──wpevideosrc

## Factory details

Authors: – Philippe Normand <philn>, Žan Doberšek <zdobersek></zdobersek></philn>

Classification: – `Source/Video`

Rank – none

Plugin – wpe

Package – gst-plugins-bad

## Pad Templates

### `src`

    video/x-raw(memory:GLMemory):
             format: RGBA
              width: [ 1, 2147483647 ]
             height: [ 1, 2147483647 ]
          framerate: [ 0/1, 2147483647/1 ]
    pixel-aspect-ratio: 1/1
     texture-target: 2D
    video/x-raw:
             format: BGRA

Presence – always

Direction – src

Object type – GstPad

## Signals

### configure-web-view

    configure_web_view_callback (GstElement * src,
                                 GObject * webview,
                                 gpointer udata)

    def configure_web_view_callback (src, webview, udata):
        #python callback for the 'configure-web-view' signal

    function configure_web_view_callback(src: GstElement * src, webview: GObject * webview, udata: gpointer udata): {
        // javascript callback for the 'configure-web-view' signal
    }

Allow application to configure the webView settings.

Parameters:

`src` –

the object which received the signal

`webview` –

the webView

`udata` –
No description available

Flags: Run Last

## Action Signals

### load-bytes

    g_signal_emit_by_name (src, "load-bytes", bytes);

    ret = src.emit ("load-bytes", bytes)

    let ret = src.emit ("load-bytes", bytes);

Load the specified bytes into the internal webView.

Parameters:

`src` (GstElement *) –

the object which received the signal

`bytes` (GBytes *) –

the GBytes data to load

Flags: Run Last / Action

### run-javascript

    g_signal_emit_by_name (src, "run-javascript", script);

    ret = src.emit ("run-javascript", script)

    let ret = src.emit ("run-javascript", script);

Asynchronously run script in the context of the current page on the internal webView.

Parameters:

`src` (GstElement *) –

the object which received the signal

`script` (gchararray) –

the script to run

Flags: Run Last / Action

Since : 1.22

## Properties

### draw-background

    “draw-background” gboolean

Whether to draw the WebView background

Flags : Read / Write

Default value : true

### location

    “location” gchararray

The URL to display

Flags : Read / Write

Default value : about:blank

The results of the search are