Shuffling Video Library React App Cloudinary
I have integrated Cloudinary video media library into our React web app and want to be able to shuffle. I am currently using playlistbyTag and would like to shuffle the videos for recommendations.
-
Hi Chikezie,
Thanks for reaching out to us! `playlistByTag` optionally takes in a `sorter` function which will determine the order of videos in the playlist. Please see the link below for some sample code:
https://codepen.io/team/Cloudinary/project/full/XLYMQV/
If you click on "Playlist by Tag" and scroll down to the `sorter` function, you can replace it with any logic you'd like. You could consider replacing the logic with checking if a `Math.random()` call returns a value greater than or equal to 0.5, or less than 0.5 in order to achieve what you want.Please let us know if this doesn't work out for you or if you have any further needs!
Regards,
Victor
0
Post is closed for comments.
Comments
1 comment