You can, but the recording needs to be done by the compositor (e.g. kwin)
Which means you will have one choice which has a 50 50 chance of being crap. We really need a single way for all compositors to delegate this functionality to a trusted application.
Application-specific permissions like on smart phones maybe?