Link Search Menu Expand Document

VideoSurface

A surface that allocates a video media track to use as texture Send frames like this

app:scheduleAction(0.02, true, function()
  if surface and surface.trackId then
    app.client.client:send_video(surface.trackId, pixeldata, width, height, [format=rgba8], [stride=width])
  end
end)

Constructor

Initiate a video surface.

A video track will be allocated for the surface. The resolution can not be changed later.

Arguments

Name Type Description
bounds Bounds The position and size of the surface
resolution Table A table ({int, int}) with width and height giving the pixel resolution of the video. Must match the width and height sent to sendFrame

Returns

Nothing


Methods

videosurface:setResolution (width, height)

Set the input video resolution. Must be called before awakened.

Arguments

Name Type Description
width ???  
height ???  

Returns

Nothing


videosurface:setVideoFormat (fmt)

Set the output video encoder format. Default “mjpeg” which is slow but compatible. You can also set it to “h264” if you provide liballonet-av, libavcodec etc.

Arguments

Name Type Description
fmt ???  

Returns

Nothing


videosurface:sendFrame (pixels, width, height, format, stride)

Send a video frame to the server

Arguments

Name Type Description
pixels String with pixel data according to format and stride
width int The number of pixels in width. Should match the width set at init.
height int The number of pixels in height. Shold match the height set at init.
format string The pixel format. For example “bgrx8”. Default: “rgba”
stride int The number of bytes for each row of pixels. Default: width*bpp

Returns

Nothing