Skip to content

Commit

Permalink
update sound plugin and captions toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
902seanryan committed Jan 24, 2024
1 parent f25edc2 commit c569de2
Show file tree
Hide file tree
Showing 11 changed files with 59 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16.19.1
v18.15.0
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.5.0] - unreleased

### Changed

- Prevent SoundPlugin from sending mute state before Application is loaded.
- Prevent CaptionsTogglePlugin from sending mute state before Application is loaded.
- updated .nvmrc to 18

## [2.4.6] - 2023-10-16

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,6 @@ There is no configuration required for the UserDataPlugin as it just handles req

## License

Copyright (c) 2022 [SpringRoll](http://github.com/SpringRoll)
Copyright (c) 2024 [SpringRoll](http://github.com/SpringRoll)

Released under the MIT License.
2 changes: 1 addition & 1 deletion dist/SpringRoll-Container-umd.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/SpringRoll-Container-umd.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

33 changes: 25 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "springroll-container",
"version": "2.4.6",
"version": "2.5.0",
"description": "The iframe controller for interacting with SpringRoll applications",
"main": "./dist/index.js",
"license": "MIT",
Expand Down
9 changes: 6 additions & 3 deletions src/plugins/CaptionsTogglePlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ export class CaptionsTogglePlugin extends ButtonPlugin {
return;
}

this.captionsMuted = !!SavedData.read(CaptionsTogglePlugin.captionsToggleKey);
const captionsMuted = !!SavedData.read(CaptionsTogglePlugin.captionsToggleKey);

this.setMuteProp('captionsMuted', captionsMuted, this._captionsButtons, true);

}.bind(this)
);
Expand All @@ -74,8 +76,9 @@ export class CaptionsTogglePlugin extends ButtonPlugin {
* @memberof CaptionsTogglePlugin
*/
start() {
this.captionsMuted = !!SavedData.read(CaptionsTogglePlugin.captionsToggleKey);

for (let i = 0; i < this.captionsButtonsLength; i++) {
this.captionsButtons[i].enableButton();
}
this.client.on('loaded', this.sendAllProperties);
this.client.on('loadDone', this.sendAllProperties);
}
Expand Down
19 changes: 13 additions & 6 deletions src/plugins/SoundPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,19 @@ export class SoundPlugin extends ButtonPlugin {
for (let i = 0; i < this.voSlidersLength; i++) {
this.voSliders[i].displaySlider(features.data);
}


const soundMuted = !!SavedData.read(SoundPlugin.soundMutedKey);
const musicMuted = !!SavedData.read(SoundPlugin.musicMutedKey);
const sfxMuted = !!SavedData.read(SoundPlugin.sfxMutedKey);
const voMuted = !!SavedData.read(SoundPlugin.voMutedKey);

// set the property in case buttons exist but disable the send here
// properties will be sent in sendAllProperties
this.setMuteProp('soundMuted', soundMuted, this.soundButtons, true);
this.setMuteProp('musicMuted', musicMuted, this.musicButtons, true);
this.setMuteProp('sfxMuted', sfxMuted, this.sfxButtons, true);
this.setMuteProp('voMuted', voMuted, this.voButtons, true);
}.bind(this)
);
}
Expand All @@ -452,7 +465,6 @@ export class SoundPlugin extends ButtonPlugin {
* @memberof SoundPlugin
*/
start() {

for (let i = 0; i < this.soundButtonsLength; i++) {
this.soundButtons[i].enableButton();
}
Expand All @@ -466,11 +478,6 @@ export class SoundPlugin extends ButtonPlugin {
this.voButtons[i].enableButton();
}

this.soundMuted = !!SavedData.read(SoundPlugin.soundMutedKey);
this.musicMuted = !!SavedData.read(SoundPlugin.musicMutedKey);
this.sfxMuted = !!SavedData.read(SoundPlugin.sfxMutedKey);
this.voMuted = !!SavedData.read(SoundPlugin.voMutedKey);

this.client.on('loaded', this.sendAllProperties);
this.client.on('loadDone', this.sendAllProperties);
}
Expand Down

0 comments on commit c569de2

Please sign in to comment.