-
Notifications
You must be signed in to change notification settings - Fork 18
Local Overrides Sample: Add Hotkeys for Switching Cameras
bp2008 edited this page Dec 30, 2022
·
1 revision
This script will add some hotkeys to switch the video player to your choice of camera or group. Edit it however you like to suit your own needs.
To learn more about ui3-local-overrides, see: Local Overrides Scripts and Styles
This example script does not use UI3's hotkey system, instead just using a basic keydown
event handler.
$(document).keydown(function (e)
{
var char = String.fromCharCode(e.which);
if (char === "A")
{
OpenCameraWithName("mailbox");
}
else if (char === "B")
{
OpenCameraWithName("segarageptz");
}
else if (char === "C")
{
OpenCameraWithName("frontwide");
}
else if (char === "Z")
{
OpenCameraWithName("Index"); // All cameras
}
});
function OpenCameraWithName(name)
{
var camera = cameraListLoader.GetCameraWithId(name);
if (camera)
videoPlayer.LoadLiveCamera(camera);
else
toaster.Error("Could not find camera: " + name);
}