Turns out, by wrapping the code in a function it takes the necessary bits out of scope, causing the nowplayingbar to become non-functional when it comes to adjusting volume. Fixes https://github.com/jellyfin/jellyfin/issues/988