The hideControls() method of p5.MediaElement in p5.js is used to hide the default media controls for the media element if they are currently shown.
Syntax:
hideControls()
Parameters: This method does not accept any parameters.
The example below illustrate the hideControls() method in p5.js:
Example:
Javascript
function setup() {
createCanvas(500, 400);
textSize(20);
example_media =
createVideo( "sample-video.mp4" );
example_media.size(500, 300);
example_media.position(20, 100);
example_media.showControls();
text( "Click on the button to " +
"hide media controls" , 20, 20);
hideBtn =
createButton( "Hide Controls" );
hideBtn.position(30, 40);
hideBtn.mousePressed(hide);
} function hide() {
// Hide the media controls
example_media.hideControls();
text( "Media controls are now hidden!" ,
20, 80);
} |
Output:
Online editor: https://editor.p5js.org/
Environment Setup: https://www.geeksforgeeks.org/p5-js-soundfile-object-installation-and-methods/amp/
Reference: https://p5js.org/reference/#/p5.MediaElement/hideControls