Hello @glennnall,
Have you tried the Privacy
option of rtMedia?
If not, you can try using the Media privacy feature - https://rtmedia.io/docs/features/privacy/
Here is the document which can guide you for the admin setting - https://rtmedia.io/docs/settings/privacy/
It depends on friends connection buddypress component. Once you enable that component you will see the Friends
privacy option under the admin settings.
Please, try this after removing your custom code and let us know if this works for you.
Thank you,
Pranali