We only want logged in users to view the video with any privacy type and for not logged in users we want to show the NOT_AUTHORIZED page, which is implemented for ‹ PRIVATE and INTERNAL › videos by default in Peertube.
Trying to filter a video using the following hook (‹ filter:api.video.get.result ›),
if we do not return a video
using this hook, the error is always ‹ video.isOutdated() is not a function › and no further execution is possible.
Is there any way to achieve what we are trying to implement (is this particular hook not the way to go?)
How can we not return a video and not get the error?
target: 'filter:api.video.get.result',
handler: async (video, userInfo) => {
if (!video) return video
if (!userInfo.userId) return { data: [] }
return video
}
})```