WebRTC Video Chat 1.1.4
Loading...
Searching...
No Matches
Byn.Awrtc.IVideoInput Interface Reference

This interface provides a cross-platform API (WebGL+native) to forward custom image data to WebRTC. More...

Public Member Functions

void AddDevice (string name, int width, int height, int fps)
 Adds a new device. It will be treated by other parts of the asset as a camera device that has only one supported format using width, height and FPS you set via this method.
 
void RemoveDevice (string name)
 Removes the device from the internal device list.
 
bool UpdateFrame (string name, byte[] dataBuffer, int width, int height, int rotation, bool firstRowIsBottom)
 Updates frames via a byte[].
Width and Height should be the size you used in AddDevice. If width and height differ it is up to the platform specific layer how this is handled.
 
bool UpdateFrame (string name, IntPtr dataPtr, int length, int width, int height, int rotation, bool firstRowIsBottom)
 WARNING: This method is inherently unsafe and can crash the application without triggering any useful exception / error message in C#. It will directly access the memory Updates frames via a byte[].
Width and Height should be the size you used in AddDevice. It is possible the lower layers will scale your image to fit the values from AddDevice though.
 

Properties

VideoInputFormat InputFormat [get]
 Recommended video input format Returns the format the byte[] and dataPtr expect as input. Other formats might be supported via platform specific implementations.
 

Detailed Description

This interface provides a cross-platform API (WebGL+native) to forward custom image data to WebRTC.

Make sure UnityCallFactory is initialized before using this.

Member Function Documentation

◆ AddDevice()

void Byn.Awrtc.IVideoInput.AddDevice ( string name,
int width,
int height,
int fps )

Adds a new device. It will be treated by other parts of the asset as a camera device that has only one supported format using width, height and FPS you set via this method.

Note that actual frame updates do not need to be done in the exact FPS but it is recommended to do so.

Parameters
namename of the device. Can be used via MediaConfig.VideoDeviceName and will be returned by UnityCallFactory.GetVideoDevices()
widthWidth of the images you want to deliver
heightHeight of the images you want to deliver
fpsexpected framerate you want to deliver

◆ RemoveDevice()

void Byn.Awrtc.IVideoInput.RemoveDevice ( string name)

Removes the device from the internal device list.

Parameters
name

◆ UpdateFrame() [1/2]

bool Byn.Awrtc.IVideoInput.UpdateFrame ( string name,
byte[] dataBuffer,
int width,
int height,
int rotation,
bool firstRowIsBottom )

Updates frames via a byte[].
Width and Height should be the size you used in AddDevice. If width and height differ it is up to the platform specific layer how this is handled.

Parameters
nameDevice name. Must be added before this call via AddDevice
dataBufferraw data of the image. Must be in the expected Format
widthwidth of the image you supply
heightheight of the image you supply
rotationAttaches a rotation value to the image. (might not work on all platforms)
firstRowIsBottomUnity often has the frames up-side-down in memory. Set this to true to flip it
Returns
Returns true if the image was updated. False if the device wasn't updated usually due to invalid input or device does not exist

◆ UpdateFrame() [2/2]

bool Byn.Awrtc.IVideoInput.UpdateFrame ( string name,
IntPtr dataPtr,
int length,
int width,
int height,
int rotation,
bool firstRowIsBottom )

WARNING: This method is inherently unsafe and can crash the application without triggering any useful exception / error message in C#. It will directly access the memory Updates frames via a byte[].
Width and Height should be the size you used in AddDevice. It is possible the lower layers will scale your image to fit the values from AddDevice though.

Parameters
nameDevice name. Must be added before this call via AddDevice
dataPtrraw data of the image. Must be in the expected Format
lengthBuffer length in bytes
widthwidth of the image you supply
heightheight of the image you supply
rotationAttaches a rotation value to the image. (might not work on all platforms)
firstRowIsBottomUnity often has the frames up-side-down in memory. Set this to true to flip it
Returns
Returns true if the image was updated. False if the device wasn't updated usually due to invalid input or device does not exist

The documentation for this interface was generated from the following file: