163
www.analogway.com
USER MANUAL
USER MANUAL
USER MANUAL
USER MANUAL
USER MANUAL
USER MANUAL
USER MANUAL
USER MANUAL
Appendix F.
Interact with web pages sources (mouse and keyboard)
Analog Way Picturall Media Servers support the displaying of web pages. Internally this is handled by the
Chromium Embedded Framework. "Web API UIEvents" can be sent to a webpage with the "send_ui_event"
lua command.
F.a.
Setting up a testing environment
While this is not a requirement and can be skipped. Let us first set up a testing environment, in the form of
some JavaScript event listeners. This way we can see the events as they are received by the webpage.
This is done by copy pasting the following into the JavaScript text box for a webpage in the media manager
or commander.
window.addEventListener('mousedown', mouselog);
window.addEventListener('mousemove', mouselog);
window.addEventListener('mouseup', mouselog);
function
mouselog
(
e
)
{
console.log("type:" + e.type + ", x:" + e.x + ", y:" + e.y + ", ctrlKey:" + e.ctrlKey);
}
window.addEventListener("keyup", keylog);
window.addEventListener("keypress", keylog);
window.addEventListener("keydown", keylog);
function
keylog
(
e
)
{
console.log("type:" + e.type + ", key:" + e.key + " (" + e.k "), code:" + e.code);
}
By default, websites console.log are ignored by showtime (to avoid spam). We can enable this console logging,
by first setting the command "set_global enable_cef_logging 1"
More info on the Web API UIEvent can be found here:
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent
https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent
F.b.
Sending UI events, a few examples
Let us start with a few simple usage examples of sending UI events, and later go into the details of the API.
F.b.a.
Clicking left mouse button
send_ui_event("source1", "Mouse ButtonLeftDown 1010 890")
send_ui_event("source1", "Mouse ButtonLeftUp 1010 890")
The website received the two UI events as:
OnConsoleMessage: type:mousedown, x:1010, y:890, ctrlKey:false
OnConsoleMessage: type:mouseup, x:1010, y:890, ctrlKey:false