Move video selection code to selectVideoFromPlaylist function