Documentation Menu

pause()

The pause() function pauses the video playback at its current position without any other side effects.

Usage

Call this function when you want to pause the video at its current position. The video will remain paused until you call play() again.

// Pause the video
Answerly.FacePop.pause();

When this function is called, the video stops at its current position. It doesn't reset the video to the beginning or affect any other settings like volume or visibility.

Example Scenarios

Pausing on User Action

// Pause the video when a button is clicked
document.getElementById('pauseButton').addEventListener('click', function() {
    Answerly.FacePop.pause();
});

Pausing When Scrolling Away

// Pause the video when it's no longer visible in the viewport
window.addEventListener('scroll', function() {
    const videoElement = document.getElementById('facePopContainer');
    const rect = videoElement.getBoundingClientRect();
    
    // If the video is not visible
    if (rect.bottom < 0 || rect.top > window.innerHeight) {
        Answerly.FacePop.pause();
    }
});

Notes

  • The pause() function simply stops the video at its current position.
  • It does not affect any other player settings such as volume, visibility, or position.
  • The video playback can be resumed later by calling play().
  • When paused, the video will maintain its current time position and will continue from that point when play is resumed.