# Multiple targets

**URL:** <https://forum.8thwall.com/t/multiple-targets/8212>\
**Category:** Technical Support\
**Created:** [September 1, 2025, 7:45pm UTC](https://forum.8thwall.com/t/multiple-targets/8212 "2025-09-01T19:45:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joe\_DeGroot](https://avatars.discourse-cdn.com/v4/letter/j/c57346/32.png) [@Joe\_DeGroot](https://forum.8thwall.com/u/Joe_DeGroot)\
**Post date:** [September 1, 2025, 7:45pm UTC](https://forum.8thwall.com/t/multiple-targets/8212/1 "2025-09-01T19:45:16Z")

</div>

Here is my code. With this the Final\_Paul,mp4 does not load at all anymore and the Oscar\_Wilde\_-\_Made\_with\_Clipchamp\_1.mp4 opens but freezes on the first frame.

import \* as ecs from ‘[@8thwall](https://forum.8thwall.com/groups/8thwall)/ecs’

ecs.registerComponent({  
name: ‘video\_Autoplay’,  
schema: {},  
schemaDefaults: {},  
data: {},  
stateMachine: ({world, eid}) =\> {  
ecs  
.defineState(‘setup’)  
.initial()  
.onEvent(world.events.globalId, ‘reality.imageloaded’, () =\> {  
// This state ensures our component is ready to handle imagefound events  
// after the reality engine has fully initialized.  
ecs.VideoControls.set(world, eid, {  
paused: false,  
})  
})  
.listen(world.events.globalId, ‘reality.imagefound’, (e: {detail: {name: string}}) =\> {  
try {  
const imageName: string = e.detail.name

```auto
      let videoSrc: string | null = null
      if (imageName === 'paulverlainestill.jpg') {
        videoSrc = 'Final_Paul.mp4'
      } else if (imageName === 'Wilde.jpg') {
        videoSrc = 'Oscar_Wilde_-_Made_with_Clipchamp_1.mp4'
      }

      if (videoSrc) {
        ecs.VideoControls.set(world, eid, {
          paused: false,
          src: videoSrc,
        })
      }
    } catch (error) {
      // You may want to handle this error in a way that doesn't use console.error
    }
  })
  .listen(world.events.globalId, 'reality.imagelost', (e) => {
    // Pause when image is lost (optional, keeps position so resume works)
    ecs.VideoControls.set(world, eid, {
      paused: true,
    })
  })

```

},  
})

---

<div class="post-metadata">

**Author:** ![GeorgeButler](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.8thwall.com/georgebutler/32/1903_2.png) [@GeorgeButler](https://forum.8thwall.com/u/GeorgeButler)\
**Post date:** [September 2, 2025, 6:29pm UTC](https://forum.8thwall.com/t/multiple-targets/8212/2 "2025-09-02T18:29:18Z")

</div>

Have you tried adding `assets/` to the start of the src file paths? For example: `assets/Final_Paul.mp4`. I’d also suggest removing the try/catch block for now and using `console.log(imageName)` to see exactly what it’s returning.

---

<div class="post-metadata">

**Author:** ![Joe\_DeGroot](https://avatars.discourse-cdn.com/v4/letter/j/c57346/32.png) [@Joe\_DeGroot](https://forum.8thwall.com/u/Joe_DeGroot)\
**Post date:** [September 2, 2025, 7:31pm UTC](https://forum.8thwall.com/t/multiple-targets/8212/3 "2025-09-02T19:31:31Z")

</div>

> [@GeorgeButler](#):
>
> removing the try/catch block for now and using `console.log(imageName)`

I made both adjustments and now the audio from one of the video plays without the video and the images don’t trigger any video.

---

<div class="post-metadata">

**Author:** ![GeorgeButler](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.8thwall.com/georgebutler/32/1903_2.png) [@GeorgeButler](https://forum.8thwall.com/u/GeorgeButler)\
**Post date:** [September 2, 2025, 8:20pm UTC](https://forum.8thwall.com/t/multiple-targets/8212/4 "2025-09-02T20:20:38Z")

</div>

Now that you’ve made the changes, could you please land them and [share the project](https://www.8thwall.com/docs/account/projects/project-sharing/#share-project-with-support) with the support workspace?
