need your help with turn on mp3 file(with wav and ogg file all is ok) from persistentDataPath in Unity. I have this code to find audio file in persistentDataPath and turn on as AudioClip
public void StartAudio()
{
StartCoroutine(PlayAudioClip());
}
IEnumerator PlayAudioClip()
{
UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(Application.persistentDataPath + "/" + "_song", AudioType.MPEG);
yield return www.Send();
//WWW testrequest = new WWW(Application.persistentDataPath + "/" + "_song.mp3");
if (www.isNetworkError)
Debug.Log("play error: " + www.error);
else
{
AudioClip audioTrack = DownloadHandlerAudioClip.GetContent(www);
audio.clip = audioTrack;
audio.Play();
}
}
But when I tried to turn on mp3 file I had this error
Streaming of 'mpeg' on this platform is not supported
UnityEngine.Networking.DownloadHandlerAudioClip:GetContent(UnityWebRequest)
答案 0 :(得分:0)
好吧,我用更多的时间在Google上搜索并建立了这个q-a,所以它真的是不真实的-(
答案 1 :(得分:0)
将 Unity 升级到 2020.1.14f1
及更高版本应该可以播放 mp3 音频剪辑。 Unity Answers。