hidePlayer()
The hidePlayer() function hides the FacePop video player widget from view without removing it from the DOM. This is useful when you want to temporarily hide the player but plan to show it again later.
Description
When called, hidePlayer() minimizes the FacePop player widget, making it invisible to the user but keeping it loaded and ready in the background. This is different from the destroy() function, which completely removes the player from the DOM.
Key points about the hidePlayer() function:
- The player is hidden from view but remains in memory
- Video playback state is preserved (if it was playing, it continues to play but is not visible)
- You can show the player again by calling
showPlayer() - This function is useful for UI adjustments or temporarily removing the player from view
Usage
To hide the FacePop player widget, simply call the hidePlayer() function:
// Hide the FacePop player widget
Answerly.FacePop.hidePlayer();
Example scenario
// When user clicks a "Hide Video" button
document.getElementById('hideVideoButton').addEventListener('click', function() {
// Hide the FacePop player
Answerly.FacePop.hidePlayer();
// Update UI to show a "Show Video" button instead
document.getElementById('hideVideoButton').classList.add('hidden');
document.getElementById('showVideoButton').classList.remove('hidden');
});
Then to show the player again:
// When user clicks a "Show Video" button
document.getElementById('showVideoButton').addEventListener('click', function() {
// Show the FacePop player
Answerly.FacePop.showPlayer();
// Update UI
document.getElementById('showVideoButton').classList.add('hidden');
document.getElementById('hideVideoButton').classList.remove('hidden');
});
Parameters
The hidePlayer() function doesn't accept any parameters.
Return Value
This function doesn't return any value.