# File in StreamingAssets won't play with programmer sound on quest 2, works in Editor

**URL:** <https://qa.fmod.com/t/file-in-streamingassets-wont-play-with-programmer-sound-on-quest-2-works-in-editor/21939>\
**Category:** Unity\
**Tags:** android, unity\
**Created:** [July 30, 2024, 11:29am UTC](https://qa.fmod.com/t/file-in-streamingassets-wont-play-with-programmer-sound-on-quest-2-works-in-editor/21939 "2024-07-30T11:29:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![krso92](https://avatars.discourse-cdn.com/v4/letter/k/838e76/32.png) [@krso92](https://qa.fmod.com/u/krso92)\
**Post date:** [July 30, 2024, 11:29am UTC](https://qa.fmod.com/t/file-in-streamingassets-wont-play-with-programmer-sound-on-quest-2-works-in-editor/21939/1 "2024-07-30T11:29:24Z")

</div>

So, i followed [this](https://fmod.com/docs/2.03/unity/examples-programmer-sounds.html) example and it works in Unity Editor. However, when I build it on Quest 2, it doesn’t play any sound.

I managed sucesfully to play events from bank, but in this case I need to play file from StreamingAssets.

I created empty project and try to make it work, but with no luck.

Callbacks are fired for `CREATED`, `STARTING`, `CREATE_PROGRAMMER_SOUND` , `STARTED`, `DESTROY_PROGRAMMER_SOUND`, `STOPPED` and `DESTROYED`, yet no sound is playing.

In logcat I get lot of these errrors:

```auto
Error DeviceConfig getProperties failed: Permission denial: reading from settings requires:android.permission.READ_DEVICE_CONFIG

```

Not sure if it is related and it seems app can’t get that permission, at least not in runtime.

Anyone had similar problem?

I am on Unity 2021.3.40f1 and FMOD 2.02.

---

<div class="post-metadata">

**Author:** ![krso92](https://avatars.discourse-cdn.com/v4/letter/k/838e76/32.png) [@krso92](https://qa.fmod.com/u/krso92)\
**Post date:** [July 30, 2024, 2:35pm UTC](https://qa.fmod.com/t/file-in-streamingassets-wont-play-with-programmer-sound-on-quest-2-works-in-editor/21939/2 "2024-07-30T14:35:55Z")

</div>

I enabled Info logging and now I have more errors in logcat.  
Seems so file is somehow not found…

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/6/6aae558da87b330dcd699102edc339b01a80d59f.png)

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [July 31, 2024, 8:14am UTC](https://qa.fmod.com/t/file-in-streamingassets-wont-play-with-programmer-sound-on-quest-2-works-in-editor/21939/3 "2024-07-31T08:14:26Z")

</div>

Hi,

Thank you for the logs.

Unfortunately, accessing the `StreamingAssets` folder is not a simple operation on Android:

> Accessing streaming assets  
> On Android and WebGL platforms, it’s not possible to access the streaming asset files directly via file system APIs and streamingAssets path because these platforms return a URL. Use the UnityWebRequest class to access the content instead.

[Unity Documentation](https://docs.unity3d.com/Manual/StreamingAssets.html#:~:text=Accessing%20streaming%20assets). They provide documentation using `UnityWebRequest` here: [UnityWebRequest](https://docs.unity3d.com/ScriptReference/Networking.UnityWebRequest.html).

---

<div class="post-metadata">

**Author:** ![krso92](https://avatars.discourse-cdn.com/v4/letter/k/838e76/32.png) [@krso92](https://qa.fmod.com/u/krso92)\
**Post date:** [July 31, 2024, 12:36pm UTC](https://qa.fmod.com/t/file-in-streamingassets-wont-play-with-programmer-sound-on-quest-2-works-in-editor/21939/5 "2024-07-31T12:36:04Z")

</div>

Hey, tnx a lot for fast reply, I missed that somehow. I didn’t figure out right away how to allocate and deallocate those downloaded bytes but I made in-memory copy of it like this:

```auto
var data = request.downloadHandler.data;
IntPtr unmanagedPointer = Marshal.AllocHGlobal(data.Length);
Marshal.Copy(data, 0, unmanagedPointer, data.Length);
var eventInstance = RuntimeManager.CreateInstance(eventName);
eventInstance.setUserData(unmanagedPointer);
EVENT_CALLBACK clb = new EVENT_CALLBACK(PlaybackEventCallback);
eventInstance.setCallback(clb);

```

and later dealocatted it like this

```auto
Marshal.FreeHGlobal(parameterPtr);

```

In case someone have similar issue.

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [July 31, 2024, 11:14pm UTC](https://qa.fmod.com/t/file-in-streamingassets-wont-play-with-programmer-sound-on-quest-2-works-in-editor/21939/6 "2024-07-31T23:14:58Z")

</div>

Thank you for sharing your solution!
