Skip to content

remove AudioSource component from not sync list #1099

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 11, 2025

Conversation

nicoecheza
Copy link
Contributor

closes decentraland/creator-hub#468

How to test:

  1. Create a new scene from some template (this one is perfect)
  2. Copy the following code into src/index.ts
import { Color4 } from '@dcl/sdk/math'
import {
  PointerEvents,
  engine,
  Transform,
  Material,
  MeshRenderer,
  AudioSource,
  Entity,
  SyncComponents,
  MeshCollider,
  PointerEventType,
  InputAction,
  inputSystem
} from '@dcl/sdk/ecs'

export function createCube(x: number, y: number, z: number, spawner = true): Entity {
  const entity = engine.addEntity()

  Transform.create(entity, { position: { x, y, z } })

  MeshRenderer.setBox(entity)
  MeshCollider.setBox(entity)
  Material.setPbrMaterial(entity, { albedoColor: Color4.Purple() })

  PointerEvents.create(entity, {
    pointerEvents: [
      { eventType: PointerEventType.PET_DOWN, eventInfo: { button: InputAction.IA_POINTER, hoverText: 'Play sound' } }
    ]
  })

  return entity
}

export function main() {
  const cube = createCube(3, 0, 3)
  AudioSource.create(cube, { audioClipUrl: 'assets/audio.mp3' })
  SyncComponents.create(cube, { componentIds: [AudioSource.componentId] })

  engine.addSystem(() => {
    if (inputSystem.isTriggered(InputAction.IA_POINTER, PointerEventType.PET_DOWN, cube)) {
      console.log('play sound')
      AudioSource.playSound(cube, 'assets/audio.mp3', true)
    }
  })
}
  1. Place some audio file in assets/audio.mp3. The name should be audio.mp3 or it won't work. Here is an example mp3 file
  2. Run the scene in multiple clients
  3. Click the purple cube in one client
  4. Sound should start playing in all clients (you might need to focus the window for the sound to start)

Copy link
Contributor

github-actions bot commented Apr 10, 2025

Test this pull request

  • The @dcl/sdk package can be tested in scenes by running

    npm install "https://sdk-team-cdn.decentraland.org/@dcl/js-sdk-toolchain/branch/remove/audio-source-from-not-sync/dcl-sdk-7.8.3-14404750916.commit-955a83a.tgz"
  • To test with npx init

    export SDK_COMMANDS="https://sdk-team-cdn.decentraland.org/@dcl/js-sdk-toolchain/branch/remove/audio-source-from-not-sync/dcl-sdk-commands-7.8.3-14404750916.commit-955a83a.tgz"
    npx $SDK_COMMANDS init
  • The @dcl/inspector package can be tested by visiting this url

    • Or by installing it via NPM
    npm install "https://sdk-team-cdn.decentraland.org/@dcl/js-sdk-toolchain/branch/remove/audio-source-from-not-sync/@dcl/inspector/dcl-inspector-7.8.3-14404750916.commit-955a83a.tgz"
  • The /changerealm command to test test in-world

    /changerealm https://sdk-team-cdn.decentraland.org/ipfs/remove/audio-source-from-not-sync-e2e
    
  • You can preview this build entering:
    https://playground.decentraland.org/?sdk-branch=remove/audio-source-from-not-sync

@nicoecheza nicoecheza force-pushed the remove/audio-source-from-not-sync branch from 9a94ca6 to 3b4dab8 Compare April 11, 2025 13:53
@nicoecheza nicoecheza enabled auto-merge (squash) April 11, 2025 13:53
Copy link

cloudflare-workers-and-pages bot commented Apr 11, 2025

Deploying js-sdk-toolchain with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3b4dab8
Status: ✅  Deploy successful!
Preview URL: https://a042843c.js-sdk-toolchain.pages.dev
Branch Preview URL: https://remove-audio-source-from-not.js-sdk-toolchain.pages.dev

View logs

@nicoecheza nicoecheza merged commit 20be957 into main Apr 11, 2025
9 checks passed
@nicoecheza nicoecheza deleted the remove/audio-source-from-not-sync branch April 11, 2025 14:05
kuruk-mm added a commit that referenced this pull request Jun 19, 2025
* update left/right click button behaviour on renderer (#1078)

* update left/right click button behaviour on renderer

* remove gizmo right click button

* fixed review comments

* remove desktop client (OLD) option (#1083)

* select "Scene" in tree on startup (#1082)

* update left/right click button behaviour on renderer

* select 'Scene' in tree on startup

* add refresh button for Assets (#1085)

* support border in uitransforms (#1084)

* support border in uitransforms

* fix build

* change protocol to experimental

* use main protocol

* fix snapshots test

* fix tests

* fix coverage

* update protocol

* export useEffect & useState (#1089)

* export useEffect & useState

* fix tests

* fix: Animation weight value (#1090)

* fix: Animation weight value

* fix: Animation weight and speed default value

* revert .vscode/settings.json

* lint

* update .crdt

* fix models removal when using filters (#1088)

* add video player to syncEntities (#1097)

* add skip-auth-screen & landscape-terrain-enabled options for preview (#1096)

* chore: Add check local packages action (#1092)

* chore: Update asset-packs package

* fix: Allow dev package

* chore: Move check no local packages to a GHAction

* chore: Update asset-packs package

* fix: Convert TS file to CJS

* fix: GHAction comment id

* chore: Move local dependencies check to ci pipeline

* fix: debug downloaded files

* chore: Enhance message

* chore: simplify comment dependencies logic

* chore: Generate comment.md to properly show in the PR

* fix: string comment

* fix: error detection

* fix: check exit code

* fix: catch exit code

* chore: Update @dcl/asset-packs

* remove AudioSource component from not sync list (#1099)

* add entity highlight when selected (#1103)

* fix: Handle components schemas errors (#1098)

* fix: Basic view TweenComponent to better handle empty entities

* fix: Sync external changes

* feat: Add Default Basic View Field

* fix: Add SyncComponents to Smart Items when using the AdminTools (#1100)

* chore: Update @dcl/asset-packs package

* fix: Update createEnumEntityId

* feat: Add new util addSyncComponentsToEntities to add the Synccomponent and Network component to multiple entities

* fix: Tests

* chore: Update @dcl/asset-packs package

* fix: Remove components for actions that doesn't create components on the fly

* fix: Add a validation to avoid include Tween and Transform in the SyncComponent at the same time

* chore: Update @dcl/asset-packs

* update @dcl/[email protected] (#1106)

* feat: add type safe entity names file (#1107)

* feat: add type safe entity names file

* fix build:

* simplify enum types

* update tests

* fix bad merge issue with onChange

* feat: change shortcut for rotating camera (#1110)

Co-authored-by: Alejandra Levy <[email protected]>

* fix Texture being flipped vertically (#1111)

* add video screen (#1105)

* add video screen

* update asset-packs package

* update ui

* update asset-packs

* update asset-packs

* fix ui styles

* fix volume and losing focus

* update assert-packs

* bump asset-packs

* feat: add search param to actions dropdown (#1113)

* feat: add search param to actions dropdown
* feat: add searchable in Trigger Action and Trigger Basic View

* feat: show selected entity first on dropdown (#1112)

* feat: show selected entity first on dropdown

* feat: remove unused import and reorder import

* Update packages/@dcl/inspector/src/components/ui/EntityField/EntityField.tsx

Co-authored-by: Gabriel Díaz <[email protected]>
Signed-off-by: Alejandra Levy <[email protected]>

* feat: update method

---------

Signed-off-by: Alejandra Levy <[email protected]>
Co-authored-by: Gabriel Díaz <[email protected]>

* Support jpg textures (#1114)

* feat: support jpg & jpge textures

* feat: support jpg and jpeg for all images inputs

* feat: update validation for textures

* feat: Update regez to support .jpg and .jpge extensions

* feat: fix lint issues

* feat: add validation on input change

* feat: change regex to pass tests

* feat: update validation on component

* feat: add error message for invalid URL and stop validating empty field

* feat: update message

* Update global value on Audio Source component (#1119)

* feat: update global value & validate source input only where there's a value

* feat: remove debugger

* Support global prop on play sound action (#1120)

* feat: support global prop on play sound action

* feat: update pacjkage json

* feat: update package json and fix issues

* feat: install asset packs version

* feat: update asset pack version

* feat: install asset packs version on inspector

* feat: remove asset packs from root package.json

* feat: update package-lock

* fix enter scene callback not being fired if there is no onLeaveCb (#1124)

* fix enter scene callback not being fired if there is no onLeaveCb

* fix tests and update asset-packs

* feat: cursor position info (#1123)

* Updated protocol and added test for the new PrimaryPointerInfo component

* Lint-fix pass

* fix play video not updaing src property (#1129)

* add default emotes (#1132)

* feat: 4088 add z-index support for ui elements (#1127)

* Updated protocol pointers to dev branch

* Added zIndex to the react-ecs component and test

(cherry picked from commit 7ea5cfd)

* Added opacity property to ui elements

* Fixed tests

* Updated protocol

* Updated snapshots

* Removed redundant definitions. Added test coverage

* Adjusted the default value in test

* ui transform  test wip

* Added more tests. Refactored parseUiTransform utility function to properly handle the new properties

* Deep clean and snapshot

* Removed redundant tests, removed redundant defaults definitions.

* Updated snapshots

* Updated default value for opacity and updated snapshots

* feat: Update asset packs package (#1135)

* update protocol from protocol-squad branch
add "make update-protocol-squad"

* fixes and update crdt snapshots

* reduce coverage to 90% for protocol-squad branch

* update protocol (add setUiFocus)

---------

Signed-off-by: Alejandra Levy <[email protected]>
Co-authored-by: Nicolas Echezarreta <[email protected]>
Co-authored-by: Gon Pombo <[email protected]>
Co-authored-by: Gabriel Díaz <[email protected]>
Co-authored-by: Alejandra Levy <[email protected]>
Co-authored-by: Alejandra Levy <[email protected]>
Co-authored-by: Alejandro Alvarez Melucci <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Play Sound action doesn't sync
2 participants