added a toggle function to toggle playback.