The playMode() function is an inbuilt function in p5.js library. This function is used to define what is happening with the loaded audio if it is triggered while in the middle of playback or not. This function is useful when you want to restart the sound during the loading time of the website, without this function the sound can be played on mouseclick or keypressed action but that does not stop the previously played sound.
playMode( string )
Note: All the sound-related functions only work when the sound library is included in the head section of the index.html file.
Parameter: This function accept a single parameter string that has two values mentioned above and described below, the default value is ‘sustain’:
- string: This parameter has two values those are restart In this mode the paly() will stop playback and start over. The sustain In this mode playback will continue simultaneously to the new playback.
Online editor: https://editor.p5js.org/
Environment Setup: https://www.geeksforgeeks.org/p5-js-soundfile-object-installation-and-methods/
Supported Browsers: The browsers are supported by p5.js playMode() function are listed below:
- Google Chrome
- Internet Explorer
- How to get the function name inside a function in PHP ?
- p5.js | arc() Function
- PHP | each() Function
- PHP | next() Function
- p5.js | nfp() Function
- D3.js | d3.map.has() Function
- p5.js | nf() Function
- PHP | Ds\Set first() Function
- PHP | Ds\Set last() Function
- D3.js | d3.map.set() Function
- p5.js | box() Function
- p5.js | nfc() function
- PHP | Ds\Set add() Function
- p5.js | nfs() Function
- p5.js | value() Function
- PHP | sin( ) Function
- PHP | end() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.