maix.webrtc
maix.webrtc module
You can use
maix.webrtcto access this module with MaixPy
This module is generated from MaixPy and MaixCDK
Module
No module
Enum
WebRTCStreamType
The stream type of webrtc
| item | describe |
|---|---|
| values | WEBRTC_STREAM_NONE: format invalid WEBRTC_STREAM_H264: WEBRTC_STREAM_H265: |
C++ defination code:
enum class WebRTCStreamType { WEBRTC_STREAM_NONE = 0, // format invalid WEBRTC_STREAM_H264, WEBRTC_STREAM_H265, }
WebRTCRCType
The rc type of webrtc
| item | describe |
|---|---|
| values | WEBRTC_RC_NONE: format invalid WEBRTC_RC_CBR: WEBRTC_RC_VBR: |
C++ defination code:
enum class WebRTCRCType { WEBRTC_RC_NONE = 0, // format invalid WEBRTC_RC_CBR, WEBRTC_RC_VBR, }
Variable
Function
Class
Region
Region class
C++ defination code:
class Region
__init__
def __init__(self, x: int, y: int, width: int, height: int, format: maix.image.Format, camera: maix.camera.Camera) -> None
Construct a new Region object
| item | description |
|---|---|
| type | func |
| param | x: region coordinate x y: region coordinate y width: region width height: region height format: region format camera: bind region to camera |
| static | False |
C++ defination code:
Region(int x, int y, int width, int height, image::Format format, camera::Camera *camera)
get_canvas
def get_canvas(self) -> maix.image.Image
Return an image object from region
| item | description |
|---|---|
| type | func |
| return | image object |
| static | False |
C++ defination code:
image::Image *get_canvas()
update_canvas
def update_canvas(self) -> maix.err.Err
Update canvas
| item | description |
|---|---|
| type | func |
| return | error code |
| static | False |
C++ defination code:
err::Err update_canvas()
WebRTC
WebRTC class
C++ defination code:
class WebRTC
__init__
def __init__(self, ip: str = '', port: int = 8000, stream_type: WebRTCStreamType = ..., rc_type: WebRTCRCType = ..., bitrate: int = 3000000, gop: int = 60, signaling_ip: str = '', signaling_port: int = 8001, stun_server: str = 'stun:stun.l.google.com:19302', http_server: bool = True) -> None
Construct a new WebRTC object
| item | description |
|---|---|
| type | func |
| param | ip: listen ip port: listen port stream_type: stream type rc_type: rc type bitrate: video bitrate gop: video gop signaling_ip: signaling server bind ip signaling_port: signaling server bind port stun_server: STUN server address http_server: whether to enable the HTTP server |
| static | False |
C++ defination code:
WebRTC(std::string ip = std::string(), int port = 8000, webrtc::WebRTCStreamType stream_type = webrtc::WebRTCStreamType::WEBRTC_STREAM_H264, webrtc::WebRTCRCType rc_type = webrtc::WebRTCRCType::WEBRTC_RC_CBR, int bitrate = 3000 * 1000, int gop = 60, std::string signaling_ip = std::string(), int signaling_port = 8001, const std::string &stun_server = "stun:stun.l.google.com:19302", bool http_server = true)
start
def start(self) -> maix.err.Err
start webrtc
| item | description |
|---|---|
| type | func |
| return | error code |
| static | False |
C++ defination code:
err::Err start()
stop
def stop(self) -> maix.err.Err
stop webrtc
| item | description |
|---|---|
| type | func |
| return | error code |
| static | False |
C++ defination code:
err::Err stop()
bind_camera
def bind_camera(self, camera: maix.camera.Camera) -> maix.err.Err
Bind camera
| item | description |
|---|---|
| type | func |
| param | camera: camera object |
| return | error code |
| static | False |
C++ defination code:
err::Err bind_camera(camera::Camera *camera)
bind_audio_recorder
def bind_audio_recorder(self, recorder: maix.audio.Recorder) -> maix.err.Err
Bind audio recorder
| item | description |
|---|---|
| type | func |
| note | If the audio_recorder object is bound, it cannot be used elsewhere. |
| param | recorder: audio recorder object |
| return | error code |
| static | False |
C++ defination code:
err::Err bind_audio_recorder(audio::Recorder *recorder)
write
def write(self, frame: maix.video.Frame) -> maix.err.Err
Write encoded video (optional, reserved)
| item | description |
|---|---|
| type | func |
| static | False |
C++ defination code:
err::Err write(video::Frame &frame)
get_url
def get_url(self) -> str
Get signaling or play url
| item | description |
|---|---|
| type | func |
| return | url |
| static | False |
C++ defination code:
std::string get_url()
get_urls
def get_urls(self) -> list[str]
Get url list
| item | description |
|---|---|
| type | func |
| return | url list |
| static | False |
C++ defination code:
std::vector<std::string> get_urls()
to_camera
def to_camera(self) -> maix.camera.Camera
Get camera object
| item | description |
|---|---|
| type | func |
| static | False |
C++ defination code:
camera::Camera *to_camera()
add_region
def add_region(self, x: int, y: int, width: int, height: int, format: maix.image.Format = ...) -> Region
return a region object, you can draw image on the region.(This function will be removed in the future)
| item | description |
|---|---|
| type | func |
| param | x: region coordinate x y: region coordinate y width: region width height: region height format: region format, support Format::FMT_BGRA8888 only |
| return | the reigon object |
| static | False |
C++ defination code:
webrtc::Region *add_region(int x, int y, int width, int height, image::Format format = image::Format::FMT_BGRA8888)
update_region
def update_region(self, region: Region) -> maix.err.Err
update and show region(This function will be removed in the future)
| item | description |
|---|---|
| type | func |
| return | error code |
| static | False |
C++ defination code:
err::Err update_region(webrtc::Region ®ion)
del_region
def del_region(self, region: Region) -> maix.err.Err
del region(This function will be removed in the future)
| item | description |
|---|---|
| type | func |
| return | error code |
| static | False |
C++ defination code:
err::Err del_region(webrtc::Region *region)
draw_rect
def draw_rect(self, id: int, x: int, y: int, width: int, height: int, color: maix.image.Color, thickness: int = 1) -> maix.err.Err
Draw a rectangle on the canvas(This function will be removed in the future)
| item | description |
|---|---|
| type | func |
| param | id: region id x: rectangle coordinate x y: rectangle coordinate y width: rectangle width height: rectangle height color: rectangle color thickness: rectangle thickness. If you set it to -1, the rectangle will be filled. |
| return | error code |
| static | False |
C++ defination code:
err::Err draw_rect(int id, int x, int y, int width, int height, image::Color color, int thickness = 1)
draw_string
def draw_string(self, id: int, x: int, y: int, str: str, color: maix.image.Color, size: int = 16, thickness: int = 1) -> maix.err.Err
Draw a string on the canvas(This function will be removed in the future)
| item | description |
|---|---|
| type | func |
| param | id: region id x: string coordinate x y: string coordinate y str: string color: string color size: string size thickness: string thickness |
| return | error code |
| static | False |
C++ defination code:
err::Err draw_string(int id, int x, int y, const char *str, image::Color color, int size = 16, int thickness = 1)