Show Player
The Answerly.FacePop.showPlayer() function displays the FacePop player when it has been previously hidden. This function allows you to make the video player visible to users after it has been hidden using the hidePlayer() function.
Syntax
Answerly.FacePop.showPlayer();
This function does not accept any parameters and does not return a value.
Example Usage
// First, hide the player
Answerly.FacePop.hidePlayer();
// Later, when you want to show it again
Answerly.FacePop.showPlayer();
// You can also use it in response to user actions
document.getElementById('showPlayerButton').addEventListener('click', function() {
Answerly.FacePop.showPlayer();
});
Try it out
Click the buttons below to see the showPlayer() function in action:
Note: This demonstration requires the FacePop SDK to be loaded on this page.
When to Use
The showPlayer() function is useful in the following scenarios:
- After temporarily hiding the player to show other content on your page
- When implementing a toggle functionality to show/hide the video player
- Following user interactions that should reveal the previously hidden player
- In response to specific user journey steps where the video should reappear
- When transitioning between different sections of your website while maintaining video context
Common Use Cases
Toggle Functionality
Implement a toggle button that allows users to show or hide the video player as needed.
let playerVisible = true;
document.getElementById('toggleButton').addEventListener('click', function() {
if (playerVisible) {
Answerly.FacePop.hidePlayer();
this.textContent = 'Show Video';
} else {
Answerly.FacePop.showPlayer();
this.textContent = 'Hide Video';
}
playerVisible = !playerVisible;
});
Timed Appearance
Hide the player initially and show it after a specified time delay.
// Hide the player when the page loads
window.addEventListener('FacePop:Loaded', function() {
Answerly.FacePop.hidePlayer();
// Show the player after 5 seconds
setTimeout(function() {
Answerly.FacePop.showPlayer();
}, 5000);
});