Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Audio Streaming audio assets error using WWW. ANDROID

Discussion in 'Audio & Video' started by hunter8052, Aug 8, 2019.

  1. hunter8052

    hunter8052

    Joined:
    Nov 25, 2017
    Posts:
    2
    I understand WWW is obsolete(according to unity) but when trying to use unity's web service the project did not work on android. if anyone knows how to fix
    Error: Cannot create FMOD::Sound instance for resource 0x0xd0e718d0: file:////song.egg, (End of file unexpectedly reached while trying to read essential data (truncated data?). )

    it would be amazing if you could help me, the code that I believe is having an error is here (I am trying to port a Open-Source project to oculus quest)
    Code (CSharp):
    1.  public IEnumerator PreviewSong(string audioFilePath)
    2.     {
    3.         SongPreview.Stop();
    4.         PreviewAudioClip = null;
    5.        var musicFolder = new System.IO.DirectoryInfo(audioFilePath);
    6.         WWW www = new WWW("file:///" + musicFolder);
    7.         yield return www;
    8.         PreviewAudioClip = www.GetAudioClip(false, true, AudioType.OGGVORBIS);
    9.         PlayNewPreview = true;
    10. }