Skip to content

Commit

Permalink
Automated Extension submission for issue #1443
Browse files Browse the repository at this point in the history
  • Loading branch information
luthfialdi99 committed Nov 19, 2024
1 parent b0c281d commit 0f7d653
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions extensions/community/PauseSoundNotFocus.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"author": "",
"category": "Audio",
"extensionNamespace": "",
"fullName": "Pause specific sound channels when game is out of focus",
"helpPath": "",
"iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQo8L3N0eWxlPg0KPGc+DQoJPHBhdGggZD0iTTI5LDMwYy0wLjMsMC0wLjUtMC4xLTAuNy0wLjNsLTI2LTI2Yy0wLjQtMC40LTAuNC0xLDAtMS40czEtMC40LDEuNCwwbDI2LDI2YzAuNCwwLjQsMC40LDEsMCwxLjQNCgkJQzI5LjUsMjkuOSwyOS4zLDMwLDI5LDMweiIvPg0KPC9nPg0KPGc+DQoJPHBhdGggZD0iTTI3LDI4LjRWM2MwLTAuNC0wLjItMC43LTAuNS0wLjljLTAuMy0wLjItMC43LTAuMi0xLDBMMTMuNyw5SDcuNkwyNywyOC40eiIvPg0KCTxwYXRoIGQ9Ik01LjIsOS40QzUuMSw5LjYsNSw5LjgsNSwxMHYxMmMwLDAuNiwwLjQsMSwxLDFoNy43bDExLjgsNi45YzAuMSwwLDAuMiwwLjEsMC4yLDAuMUw1LjIsOS40eiIvPg0KPC9nPg0KPC9zdmc+DQo=",
"name": "PauseSoundNotFocus",
"previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/Glyphster Pack/Master/SVG/Computers and Hardware/248d073b73586eee2fc2cfc41cafc0d7ae9bec9ad4f8f8125592c63fa64b3c0d_Computers and Hardware_speaker_audio_sound_off.svg",
"shortDescription": "Pause a specific sound channels when game is out of focus.",
"version": "1.0.0",
"description": [
"This extension gives you the ability to pause specific sound channels when the game is out of focus, either because you switch windows, open another tab in the browser, or for any other reason.",
"",
"When focus is regained, the specified sound channel(s) will resume playback."
],
"tags": [
"audio",
"focus",
"sound",
"channel",
"pause"
],
"authorIds": [
"B89d8DyliabZDfWwc6DEmWSS7wk2"
],
"dependencies": [],
"globalVariables": [],
"sceneVariables": [],
"eventsFunctions": [
{
"description": "Pauses a sound channel when game is not focused, it will resumes when the game regained focus.",
"fullName": "Pause a sound channel if game isn't focused",
"functionType": "Action",
"name": "PauseASoundChannel",
"sentence": "Pause sound on channel _PARAM1_ when game is not focused",
"events": [
{
"type": "BuiltinCommonInstructions::JsCode",
"inlineCode": [
"var sound_manager = runtimeScene.getGame().getSoundManager();\r",
"\r",
"window.addEventListener('focus', function (event) {\r",
"sound_manager.getSoundOnChannel(eventsFunctionContext.getArgument(\"SoundOnChannel\")).play();\r",
"});\r",
"\r",
"window.addEventListener('blur', function (event) {\r",
"sound_manager.getSoundOnChannel(eventsFunctionContext.getArgument(\"SoundOnChannel\")).pause();\r",
"});"
],
"parameterObjects": "",
"useStrict": true,
"eventsSheetExpanded": false
}
],
"parameters": [
{
"description": "Sound channel",
"name": "SoundOnChannel",
"supplementaryInformation": "sceneSound Channel",
"type": "expression"
}
],
"objectGroups": []
}
],
"eventsBasedBehaviors": [],
"eventsBasedObjects": []
}

0 comments on commit 0f7d653

Please sign in to comment.