onPlayerStateChange logic