Audiokinetic's Community Q&A is the forum where users can ask and answer questions within the Wwise and Strata communities. If you would like to get an answer from Audiokinetic's Technical support team, make sure you use the Support Tickets page.

Stream media got cannot open file after leaving a level.

+10 votes
We have an issue of streaming media does not play after leaving a level. This issue can reproduce by a clean UE4.27.1 + wwise 2021.4.7707 project.

Our environment are listed below:
Environment
    Windows 10

    wwise 2021.1.4.7707

    Unreal 4.27.1 Release from Epic Launcher

    Use Event-Based Packaging is true

 

Reproduce Steps:

1.We created two music tracks in wwise. The one is set to streaming (Audio1), and the other is set to non streaming (Audio2).

2.Create two maps in UE4. The Map1 plays Audio1 when level starts; the Map2 plays Audio2 when level starts.

3.Play with Standalone game starts with Map1. Audio1 is played.
4. Use console command open Map2 to travel the map to Map2. Audio2 is played.

5. Use console command open Map1 to travel the map to Map1. Audio1 is not played. The log shows:

LogAkAudio: Error: Cannot open file: 411434698

LogAkAudio: Error: Failed creating source: 411434698

6. Use console command open Map2 to travel the map to Map2. Audio2 is played.

 

Notes:

In step1. Not only music track, Sound SFX does not works also if the media is set to stream.

In step3. Only Play in editor works well without any issue. However, packaged game and standalone game in editor do not works.

 

Please let me know if you have already know this issue or have a fix for this.

Thank you.
asked Nov 10, 2021 in General Discussion by windkey k. (200 points)

1 Answer

+3 votes
We also had this issue.  The problem we found is that any streamed media that is not flagged to be prefetched won't have bIsMediaSet set to true at any point.

Here is snippet of the change we made to UAkMediaAsset::LoadAndSetMedia() to fix this issue:

    auto& DataChunk = MediaAssetData->DataChunks[0];
    if (MediaAssetData->IsStreamed && !DataChunk.IsPrefetch)
    {
        FAkUnrealIOHook::AddStreamingMedia(this);
        LoadRefCount.Increment();

        // This flag was not being set on streamed media, causing
        // UAkMediaAsset::IsReadyForFinishDestroy to follow the wrong path during GC which
        // would prevent FAkUnrealIOHook::RemoveStreamingMedia from being called. After
        // this failure, the media asset would no longer stream properly. This flag would
        // normally be set by UAkMediaAsset::DoSetMedia however this is not run for
        // non-prefetch, streamed media due to this early out.
        bIsMediaSet = true;

        return;
    }
answered Mar 23, 2022 by John M. (200 points)
edited Mar 23, 2022 by John M.
Thank you! I am happy to confirm that this works.
Adding the prefetch flag on a streamed music track fixes my "failed play" issue, will try your solution thank you!
...