Search Issue Tracker

Fixed in 2021.1.X

Fixed in 2018.4.X, 2019.4.X, 2020.1.X, 2020.2.X

Votes

2

Found in

2018.4

2019.3.15f1

2019.4

2020.1

2020.2

Issue ID

1252868

Regression

No

Platform not supported error is thrown when trying to play an MP3 file in editor with build platform set to WebGL

Audio

-

Reproduction steps:
1. Open attached project "1252868"
2. Open scene "SampleScene"
3. make sure WebGL is set as the build platform
4. Enter Play Mode

Expected result: Audio is played
Actual result: Platform not supported error is thrown

Reproducible with: 2018.4.23f1, 2019.4.0f1, 2020.1.0b13, 2020.2.0a15

Note: Issue is not reproducible in a built game

Full error:
Streaming of 'mpeg' on this platform is not supported
UnityEngine.Networking.DownloadHandlerAudioClip:GetContent (UnityEngine.Networking.UnityWebRequest)
AudioRequest/<SendGetAudio>d__1:MoveNext () (at Assets/Scripts/WebFileRequest.cs:44)
UnityEngine.SetupCoroutine:InvokeMoveNext (System.Collections.IEnumerator,intptr)

  1. Resolution Note (fix version 2021.1):

    Fixed in 2021.1.0a3

  2. Resolution Note (fix version 2020.2):

    Fixed in 2020.2.0b10

  3. Resolution Note (fix version 2020.1):

    Fixed in 2020.1.12f1

  4. Resolution Note (fix version 2019.4):

    Fixed in 2019.4.15f1

  5. Resolution Note (fix version 2018.4):

    Fixed in 2018.4.29f1

Comments (1)

  1. iscf

    Jul 09, 2020 08:19

    Use this slution in Editor : https://answers.unity.com/questions/737002/wav-byte-to-audioclip.html

    No problem in build so here the code i use :

    ```
    public class AudioRequest
    {
    public AudioClip audioClip = null;

    public IEnumerator SendGetAudio(string url)
    {
    //Due to bug in Editor MP3 not supported

    using (UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(url, AudioType.MPEG))
    {
    yield return www.SendWebRequest();

    if (www.isNetworkError || www.isHttpError)
    {
    throw new Exception(www.error + "\n>>" + url);
    }
    else
    {
    #if UNITY_EDITOR
    audioClip = NAudioPlayer.FromMp3Data(www.downloadHandler.data);
    #else
    audioClip = DownloadHandlerAudioClip.GetContent(www);
    #endif
    }
    }
    }
    }
    ```

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.