In Unity, I'm using the following code to stream audio from the server, but I don't know how to add a seek bar(slider to change the playing duration) to it. Any help would be much appreciated.
IEnumerator GetAudioClip()
{
using (UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(url, AudioType.MPEG))
{
DownloadHandlerAudioClip dHA = new DownloadHandlerAudioClip(url, AudioType.MPEG);
dHA.streamAudio = true;
www.downloadHandler = dHA;
www.SendWebRequest();
while (www.downloadProgress < 0.01)
{
Debug.Log(www.downloadProgress);
yield return new WaitForSeconds(.1f);
}
if (www.isNetworkError)
{
Debug.Log("error");
}
else
{
audioSource.clip = dHA.audioClip;
audioSource.Play();
}
}
}