|
virtual | ~WebRTCWindowSystem () |
|
OSWindow | CreateOSWindow (gui::Window *o3d_window, int width, int height, const char *title, int flags) override |
|
void | DestroyWindow (OSWindow w) override |
|
std::vector< std::string > | GetWindowUIDs () const |
| List available windows. More...
|
|
std::string | GetWindowUID (OSWindow w) const |
|
OSWindow | GetOSWindowByUID (const std::string &uid) const |
|
void | StartWebRTCServer () |
| Start WebRTC server in a background thread. More...
|
|
std::string | OnDataChannelMessage (const std::string &message) |
|
void | RegisterDataChannelMessageCallback (const std::string &class_name, const std::function< std::string(const std::string &)> callback) |
|
void | OnFrame (const std::string &window_uid, const std::shared_ptr< core::Tensor > &im) |
| Server -> client frame. More...
|
|
void | SendInitFrames (const std::string &window_uid) |
|
std::string | CallHttpAPI (const std::string &entry_point, const std::string &query_string="", const std::string &data="") const |
| Call PeerConnectionManager's web request API. More...
|
|
void | EnableWebRTC () |
|
void | DisableHttpHandshake () |
|
void | CloseWindowConnections (const std::string &window_uid) |
| Close all WebRTC connections that correspond to a Window. More...
|
|
| BitmapWindowSystem (Rendering mode=Rendering::NORMAL) |
|
| ~BitmapWindowSystem () |
|
void | Initialize () override |
|
void | Uninitialize () override |
|
void | SetOnWindowDraw (OnDrawCallback callback) |
|
void | WaitEventsTimeout (double timeout_secs) override |
|
Size | GetScreenSize (OSWindow w) override |
|
void | PostRedrawEvent (OSWindow w) override |
|
void | PostMouseEvent (OSWindow w, const MouseEvent &e) |
|
void | PostKeyEvent (OSWindow w, const KeyEvent &e) |
|
void | PostTextInputEvent (OSWindow w, const TextInputEvent &e) |
|
bool | GetWindowIsVisible (OSWindow w) const override |
|
void | ShowWindow (OSWindow w, bool show) override |
|
void | RaiseWindowToTop (OSWindow w) override |
|
bool | IsActiveWindow (OSWindow w) const override |
|
Point | GetWindowPos (OSWindow w) const override |
|
void | SetWindowPos (OSWindow w, int x, int y) override |
|
Size | GetWindowSize (OSWindow w) const override |
|
void | SetWindowSize (OSWindow w, int width, int height) override |
|
Size | GetWindowSizePixels (OSWindow w) const override |
|
void | SetWindowSizePixels (OSWindow w, const Size &size) override |
|
float | GetWindowScaleFactor (OSWindow w) const override |
|
float | GetUIScaleFactor (OSWindow w) const override |
|
void | SetWindowTitle (OSWindow w, const char *title) override |
|
Point | GetMousePosInWindow (OSWindow w) const override |
|
int | GetMouseButtons (OSWindow w) const override |
|
void | CancelUserClose (OSWindow w) override |
|
void * | GetNativeDrawable (OSWindow w) override |
|
rendering::FilamentRenderer * | CreateRenderer (OSWindow w) override |
|
void | ResizeRenderer (OSWindow w, rendering::FilamentRenderer *renderer) override |
|
MenuBase * | CreateOSMenu () override |
|
virtual | ~WindowSystem () |
|
WebRTCWindowSystem is a BitmapWindowSystem with a WebRTC server that sends video frames to remote clients for visualization.
WebRTCWindowSystem owns a PeerConnectionManager, which manages all things related to the WebRTC connections, e.g. get media lists, get and add ICE candidates, connect to a media and hangup.
When the client visit a Open3D visualizer's website for visualization (a.k.a. standalone mode), an HTTP handshake server will be used to serve the website and perform handshake to establish the WebRTC connection. In Jupyter mode, the HTTP handshake server is disabled and the handshake is done via Jupyter's JavaScript<->Python communication channel.
WebRTCWindowSystem shall be used as a global singleton. Both the PeerConnectionManager and the HTTP handshake server runs on different threads.
std::string open3d::visualization::webrtc_server::WebRTCWindowSystem::CallHttpAPI |
( |
const std::string & |
entry_point, |
|
|
const std::string & |
query_string = "" , |
|
|
const std::string & |
data = "" |
|
) |
| const |
Call PeerConnectionManager's web request API.
This function is called in JavaScript via Python binding to mimic the behavior of sending HTTP request via fetch() in JavaScript.
With fetch: data = {method: "POST", body: JSON.stringify(candidate)}; fetch("/api/addIceCandidate?peerid=" + peerid, data);
Now with CallHttpAPI: open3d.visualization.webrtc_server("/api/addIceCandidate", "?peerid=" + peerid, data["body"]);
- Parameters
-
entry_point | URL part before '?'. |
query_string | URL part after '?', including '?'. If '?' is not the first character or if the string is empty, the query_string is ignored. |
data | JSON-encoded string. |