Add Custom Video Privacy and add restrictions?


I want to add a custom video privacy that adds certain restriction (privacy) to the video. According to the documentation it can be added using videoPrivacyManager.addConstant(5, 'Friends only').


I have also added one in the screenshot. So, I want to add restriction (rules) to the video if a user selects « Friends only » from the dropdown. i.e. only limit to certain users.

How can it be achievable?

Regarding the above problem following error is displayed in the console.

error: Error in controller. {
  "err": "Error: Unknown video privacy 5 to know if the video requires auth\n    at VideoModel.requiresAuth (/home/PeerTube/dist/server/models/video/video.js:960:19)\n    at /home/PeerTube/dist/server/middlewares/validators/shared/videos.js:82:19\n    at (<anonymous>)\n    at /home/PeerTube/node_modules/tslib/tslib.js:167:75\n    at new Promise (<anonymous>)\n    at Object.__awaiter (/home/PeerTube/node_modules/tslib/tslib.js:163:16)\n    at checkCanSeeVideo (/home/PeerTube/dist/server/middlewares/validators/shared/videos.js:80:20)\n    at /home/PeerTube/dist/server/middlewares/validators/videos/videos.js:214:55\n    at (<anonymous>)\n    at fulfilled (/home/PeerTube/node_modules/tslib/tslib.js:164:62)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"

If anyone has successfully added the custom video privacy and added restrictions to video based on newly added privacy please help me solve this problem. It would be a lot helpful. Thank you in advance.


I’m sorry but adding a privacy is not supported by peertube


Then what is the purpose of videoPrivacyManager.addConstant()?

It should not exist, you can create an issue on github so we remove it