Have you tried using Print Screen to debug it and make sure the correct integer is coming out?
This code looks correct.
Is your media player in the level?
Does your media sources contain a source?
Sorry if these are basic questions but it could be something simple preventing you.