# Video player API audio help after first video

**URL:** <https://qa.fmod.com/t/video-player-api-audio-help-after-first-video/20803>\
**Category:** Unity\
**Created:** [October 24, 2023, 4:54pm UTC](https://qa.fmod.com/t/video-player-api-audio-help-after-first-video/20803 "2023-10-24T16:54:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![flag74](https://avatars.discourse-cdn.com/v4/letter/f/ecc23a/32.png) [@flag74](https://qa.fmod.com/u/flag74)\
**Post date:** [October 24, 2023, 4:54pm UTC](https://qa.fmod.com/t/video-player-api-audio-help-after-first-video/20803/1 "2023-10-24T16:54:48Z")

</div>

Hi,  
I’m using the code below to forward to Audio to FMOD and it works as espected.  
[https://www.fmod.com/docs/2.02/unity/examples-video-playback.html](https://www.fmod.com/docs/2.02/unity/examples-video-playback.html)

My issue is that I’m unable to reset fmod correctly and being it able to reproduce another video after the first. (The audio is muted the second time)  
How do I reset everything?  
For every video I repeat the init process, but it doesn’t seem to work.

---

<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:** [October 25, 2023, 10:50pm UTC](https://qa.fmod.com/t/video-player-api-audio-help-after-first-video/20803/2 "2023-10-25T22:50:47Z")

</div>

Hi,

What version of FMOD Integration are you using?

When you mention `reset` are you shutting down the FMOD system ([FMOD Engine | White Papers - Getting Started](https://fmod.com/docs/2.02/api/white-papers-getting-started.html#shut-down)) or would it be possible to see the code you are using to reset your system?

Would you be able to expand on the init process you are using as well?

---

<div class="post-metadata">

**Author:** ![flag74](https://avatars.discourse-cdn.com/v4/letter/f/ecc23a/32.png) [@flag74](https://qa.fmod.com/u/flag74)\
**Post date:** [October 26, 2023, 4:44pm UTC](https://qa.fmod.com/t/video-player-api-audio-help-after-first-video/20803/3 "2023-10-26T16:44:50Z")

</div>

Unity 2022.3.11  
FMOD 2.02.13

```auto
//on init
            Player.audioOutputMode = VideoAudioOutputMode.APIOnly;
            Player.prepareCompleted += onVideoPrepared;

//on play
            fmod_mSampleRate = (int)(Player.GetAudioSampleRate(0) * Player.playbackSpeed);

            fmod_mDriftThreshold = (uint)(fmod_mSampleRate * FMOD_DRIFT_MS) / 1000;
            fmod_mTargetLatency = (uint)(fmod_mSampleRate * FMOD_LATENCY_MS) / 1000;
            fmod_mAdjustedLatency = fmod_mTargetLatency;
            fmod_mActualLatency = (int)fmod_mTargetLatency;

            fmod_mExinfo.cbsize = Marshal.SizeOf(typeof(FMOD.CREATESOUNDEXINFO));
            fmod_mExinfo.numchannels = Player.GetAudioChannelCount(0);
            fmod_mExinfo.defaultfrequency = fmod_mSampleRate;
            fmod_mExinfo.length = fmod_mTargetLatency * (uint)fmod_mExinfo.numchannels * sizeof(float);
            fmod_mExinfo.format = FMOD.SOUND_FORMAT.PCMFLOAT;

            FMODUnity.RuntimeManager.CoreSystem.createSound("", FMOD.MODE.LOOP_NORMAL | FMOD.MODE.OPENUSER, ref fmod_mExinfo, out fmod_mSound);
            Player.Prepare();

//on prepared
            fmod_mProvider = Player.GetAudioSampleProvider(0);
            fmod_mProvider.sampleFramesAvailable += fmod_sampleFramesAvailable;
            fmod_mProvider.enableSampleFramesAvailableEvents = true;
            fmod_mProvider.freeSampleFrameCountLowThreshold = fmod_mProvider.maxSampleFrameCount - fmod_mTargetLatency;
            Player.Play();

//on stop (loop reached)
            Player.Stop();
            fmod_mChannel.stop();
            fmod_mSound.release();

```

---

<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:** [October 30, 2023, 1:40am UTC](https://qa.fmod.com/t/video-player-api-audio-help-after-first-video/20803/4 "2023-10-30T01:40:47Z")

</div>

Hi,

Thank you for that.

When you are trying to play the second time are you seeing any FMOD errors in the console with the FMOD Integration logging level set to `Warning`:  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/4/48d346abb72d0059c30e32620304cd151ffbf1d1.png)

It may be an issue with the sound or channel.

If you have followed our scripting example I would suggest adding some `FMOD.RESULT` checks ([FMOD Engine | Core API Reference - Common](https://fmod.com/docs/2.02/api/core-api-common.html#fmod_result)) which will also provide some more information where it is failing. Most FMOD functions will return an `FMOD_RESULT`.
