After hours at the Brooklyn Museum on Friday night, hundreds of young people bopped along while a D.J. cycled through the summer’s hottest rap and R&B songs. As the event reached its climax, the ubiquitous opening notes of a guaranteed crowd pleaser — “Work,” by Rihanna, featuring Drake — vibrated through the room.

But when the vocals on the demo recording started, it was obvious that this wasn’t the version that spent nine weeks as the No. 1 song in the country.

In place of Rihanna, the nimble, addictive patois was delivered by PartyNextDoor, 23, the Canadian producer and R&B singer who wrote the song’s island-inflected melody and helped to usher in a pop moment deeply indebted to the Caribbean.

PartyNextDoor, gliding through the crowd to the D.J. booth, was not there to celebrate his role in the song of the summer, however, nor was he touting his contributions to Drake’s latest album, “Views,” which spent 12 weeks atop the Billboard chart. “PartyNextDoor 3,” his own new album, had just been released, capping one of the more quietly influential runs of 2016. Now he was, somewhat reluctantly, the main attraction.