+ return res.json(videoLive.toFormattedJSON(canSeePrivateLiveInformation(res)))
+}
+
+function getLiveReplaySession (req: express.Request, res: express.Response) {
+ const session = res.locals.videoLiveSession
+
+ return res.json(session.toFormattedJSON())
+}
+
+async function getLiveVideoSessions (req: express.Request, res: express.Response) {
+ const videoLive = res.locals.videoLive
+
+ const data = await VideoLiveSessionModel.listSessionsOfLiveForAPI({ videoId: videoLive.videoId })
+
+ return res.json(getFormattedObjects(data, data.length))
+}
+
+function canSeePrivateLiveInformation (res: express.Response) {
+ const user = res.locals.oauth?.token.User
+ if (!user) return false
+
+ if (user.hasRight(UserRight.GET_ANY_LIVE)) return true
+
+ const video = res.locals.videoAll
+ return video.VideoChannel.Account.userId === user.id