});
}
+void CEFCapture::execute_javascript_async(const string &js)
+{
+ post_to_cef_ui_thread([this, js] {
+ CefString script_url("<theme eval>");
+ int start_line = 1;
+ browser->GetMainFrame()->ExecuteJavaScript(js, script_url, start_line);
+ });
+}
+
void CEFCapture::OnPaint(const void *buffer, int width, int height)
{
steady_clock::time_point timestamp = steady_clock::now();
void set_url(const std::string &url);
void reload();
void set_max_fps(int max_fps);
+ void execute_javascript_async(const std::string &js);
void OnPaint(const void *buffer, int width, int height);
return 0;
}
+int HTMLInput_execute_javascript_async(lua_State* L)
+{
+ assert(lua_gettop(L) == 2);
+ CEFCapture **video_input = (CEFCapture **)luaL_checkudata(L, 1, "HTMLInput");
+ string js = checkstdstring(L, 2);
+ (*video_input)->execute_javascript_async(js);
+ return 0;
+}
+
int HTMLInput_get_signal_num(lua_State* L)
{
assert(lua_gettop(L) == 1);
};
const luaL_Reg HTMLInput_funcs[] = {
- // TODO: execute_javascript
{ "new", HTMLInput_new },
{ "set_url", HTMLInput_set_url },
{ "reload", HTMLInput_reload },
{ "set_max_fps", HTMLInput_set_max_fps },
+ { "execute_javascript_async", HTMLInput_execute_javascript_async },
{ "get_signal_num", HTMLInput_get_signal_num },
{ NULL, NULL }
};