image-source: Add shuffled playback mode for slide show #12656
+47
−9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Like shuffling a deck of cards this playback mode ensures all slides are presented evenly while still being random. Can repeat a slide once when the deck is exhausted. Intended to be used with more than ten slides for the best results.
Motivation and Context
The current Random slideshow picks a random index, repeating picks if the same slide happens to be selected. For large slide shows it's possible and undesirable to favor picking the same few slides. This has been mentioned as a problem in this RFC[1], and a plugin[2] was created to solve this, but I feel it is over complicated requiring many steps of setup outside of OBS, and may be out of date.
[1]: RFC 17
[2]: Browser Image Slideshow
For example if a popular streamer shows community made art, the Loop mode may get stale showing the same images in sequence, while Random may happen to favor some art over others unfairly. Shuffled ensures every slide is shown before repeating.
How Has This Been Tested?
I tested on my x86_64 Arch linux, with various files ensuring a low and high count of files work. I used the
blog
function to thoroughly test how and when shuffling is applied, and removedblog
statements before committing. This PR should be as platform agnostic as the current slideshow implementation.Types of changes
Checklist: