import "pkg:/source/utils/RingBuffer.bs" function Init() ' We keep in memory the last videos we watched, to avoid a loop ' Sometimes recommended videos point to each other, and we're stuck watching ' The same 2 videos over and over again ' TODO:P1 get rid of `watchedVideos` and use the PlayQueue instead m.watchedVideos = new RingBuffer(100) end function function watchedVideosContain(videoId as string) as boolean return m.watchedVideos.Contains(videoId) end function function watchedVideosAdd(videoId as string) if not watchedVideosContain(videoId) m.watchedVideos.Push(videoId) end if end function function watchedVideosClear(unused as dynamic) m.watchedVideos = new RingBuffer(100) end function