evmux-app-framework 0.1.12 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "evmux-app-framework",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -85,6 +85,7 @@ let createEventResultObject = (requestName, eventName, result) => {
85
85
  }
86
86
 
87
87
  init(app) {
88
+ this._app = app
88
89
  window.onmessage = this.onPostMessage.bind(this);
89
90
  this.initRequestHandlerProjectSpecific(app)
90
91
  }
@@ -174,18 +175,19 @@ let createEventResultObject = (requestName, eventName, result) => {
174
175
  return Object.keys(appInstance.instances).length
175
176
  }
176
177
 
177
- setComponentVolumeMultiplier(userAppInstanceId, componentId, value) {
178
+ setComponentProps(userAppInstanceId, componentId, props) {
178
179
  const appInstance = this._userAppInstances[userAppInstanceId]
179
180
  if (appInstance && appInstance.instances && appInstance.instances[componentId]) {
180
- appInstance.instances[componentId].volumeMultiplier = value
181
+ Object.assign(appInstance.instances[componentId], props)
181
182
  }
182
183
  }
183
184
 
184
- getComponentVolumeMultiplier(userAppInstanceId, componentId) {
185
- const appInstance = this._userAppInstances[userAppInstanceId]
186
- if (appInstance && appInstance.instances && appInstance.instances[componentId]) {
187
- return appInstance.instances[componentId].volumeMultiplier ?? 1
188
- }
185
+ computeVolumeMultiplier(userAppInstanceId, componentId) {
186
+ if (this.getComponentCount(userAppInstanceId) <= 1) return 1
187
+ const isPrv = componentId.startsWith('live_')
188
+ if (this._app?.studioMode && !isPrv) return 0
189
+ const comp = this._userAppInstances[userAppInstanceId]?.instances?.[componentId]
190
+ if (this._app?.isLandscapeAndPortraitMode && comp?.portraitMode) return 0
189
191
  return 1
190
192
  }
191
193
 
@@ -261,7 +263,7 @@ let createEventResultObject = (requestName, eventName, result) => {
261
263
  }
262
264
  else if (requestObj.request == availableRequests.getVolumeMultiplier)
263
265
  {
264
- result = { value: this.getComponentVolumeMultiplier(requestObj.userAppInstanceId, requestObj.componentId) }
266
+ result = { value: this.computeVolumeMultiplier(requestObj.userAppInstanceId, requestObj.componentId) }
265
267
  }
266
268
  else {
267
269
  for (let i = 0; i < this._requestHandlers.length; i++)