pstream is dead; long live pstream taciturnaxolotl.github.io/pstream-ng/
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Shuffle thumbnail generation queue for even distribution

Updated makeQueue to shuffle thumbnail indices before mapping them to positions, ensuring a more even and randomized distribution of thumbnails.

Pas b8ca5c3f bd491f2d

+8 -4
+8 -4
src/components/player/internals/ThumbnailScraper.tsx
··· 13 13 import { isSafari } from "@/utils/detectFeatures"; 14 14 15 15 function makeQueue(thumbnails: number): number[] { 16 - const output = []; 17 - for (let i = 0; i < thumbnails; i += 1) { 18 - output.push(i / (thumbnails - 1)); 16 + // Create a shuffled array of indices to ensure even distribution 17 + const indices = Array.from({ length: thumbnails }, (_, i) => i); 18 + for (let i = indices.length - 1; i > 0; i -= 1) { 19 + const j = Math.floor(Math.random() * (i + 1)); 20 + [indices[i], indices[j]] = [indices[j], indices[i]]; 19 21 } 20 - return output; 22 + 23 + // Convert shuffled indices to evenly distributed positions 24 + return indices.map((i) => i / (thumbnails - 1)); 21 25 } 22 26 23 27 function selectLowestQuality(source: SourceSliceSource): LoadableSource {