Skip to content

fix: Sporadic Blockingin loadFile()/loadMem() Methods #357

@xkos

Description

@xkos

Description

Sometimes, Block with loadFile()/loadMem() Methods in IOS

Steps To Reproduce

  1. Launch app use flutter run
  2. init with loadFile or loadMem
  3. Sometimes, only the first log entry is printed while subsequent log entries and all following code executions are halted.
  4. When using loadMem(), I have confirmed that the readAsBytesSync is completed, and the log contains the data length output.

code like this:

// final data = cachedFile.file.readAsBytesSync();
logger.debug('[$_cacheKey] load file[${cachedFile.file.absolute.path}]');
// _audioPlayer = await SoLoud.instance.loadMem('${_cacheKey}.${_fileExtension}', data, mode: LoadMode.memory);
_audioPlayer = await SoLoud.instance.loadFile(cachedFile.file.absolute.path, mode: LoadMode.memory);
logger.debug('[$_cacheKey] load player succ');

example data

filepath:
/var/mobile/Containers/Data/Application/BxxxxxxxF-xxxx-xxxx-xxxx-xxxxxxx/Library/Caches/libNextCachedAudioPlayerPlusData/bf264f30-ba34-11f0-bd63-373ffeb5cb05.mp3

Additional Context

IOS, flutter_soloud: ^3.4.0 (I have also encountered this issue sporadically when using 3.3.9)

Both iPhones and iOS simulators have experienced this issue.

Currently unable to reliably reproduce the issue, but observed that when it occurs, the same file exhibits this behavior even after hot reload. The issue resolves completely after exiting and re-running flutter run

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions