'Is it possible to get AudioClip from m3u stream in Unity?
I'm trying to reproduce a stream audio in my unity app with a button in his onclick, i've already tried with some methods i found but it doesn't end the download... I post my class above:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
public class Audio_player : MonoBehaviour
{
AudioSource audioSource;
AudioClip myClip;
void Start()
{
audioSource = GetComponent<AudioSource>();
StartCoroutine(GetAudioClip());
Debug.Log("Starting to download the audio...");
}
IEnumerator GetAudioClip()
{
using (UnityWebRequest www =
UnityWebRequestMultimedia.GetAudioClip("url-sample",
AudioType.UNKNOWN))
{
yield return www.SendWebRequest();
if (www.isNetworkError)
{
Debug.Log(www.error);
}
else
{
myClip = DownloadHandlerAudioClip.GetContent(www);
audioSource.clip = myClip;
audioSource.Play();
Debug.Log("Audio is playing.");
}
}
}
public void pauseAudio(){
audioSource.Pause();
}
public void playAudio(){
audioSource.Play();
}
public void stopAudio(){
audioSource.Stop();
}
}
The console just pop up 2 messages after this onclick(): -[Adaptive Performance] No Provider was configured for use. Make sure you added at least one Provider in the Adaptive Performance Settings. 0x00007ff68171b5cd (Unity) StackWalker::GetCurrentCallstack -Starting to download the audio... 0x00007ff68171b5cd (Unity) StackWalker::GetCurrentCallstack
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
