]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/views/video-views-manager.ts
Improve views/viewers documentation
[github/Chocobozzz/PeerTube.git] / server / lib / views / video-views-manager.ts
index e07af1ca940f39cca68a6fb4b0e43a204cd26886..9382fb482401fb4441cb1f3dbf34430620dd1ade 100644 (file)
@@ -3,6 +3,24 @@ import { MVideo } from '@server/types/models'
 import { VideoViewEvent } from '@shared/models'
 import { VideoViewers, VideoViews } from './shared'
 
+/**
+ * If processing a local view:
+ *  - We update viewer information (segments watched, watch time etc)
+ *  - We add +1 to video viewers counter if this is a new viewer
+ *  - We add +1 to video views counter if this is a new view and if the user watched enough seconds
+ *  - We send AP message to notify about this viewer and this view
+ *  - We update last video time for the user if authenticated
+ *
+ * If processing a remote view:
+ *  - We add +1 to video viewers counter
+ *  - We add +1 to video views counter
+ *
+ * A viewer is a someone that watched one or multiple sections of a video
+ * A viewer that watched only a few seconds of a video may not increment the video views counter
+ * Viewers statistics are sent to origin instance using the `WatchAction` ActivityPub object
+ *
+ */
+
 const lTags = loggerTagsFactory('views')
 
 export class VideoViewsManager {