I do this with idletime and/or an explicit timer. If done with idletime then any interaction with the pano, such as moving with the mouse, will start the timer over as soon as you let go of the mouse. You can get fancy, for instance on mousedown the timer gets paused and on mouse up just restart it, but if less than 5 seconds remain set the remaining time to 5 seconds.