Hello,
i am using EasyAR Version : 3.0.1-final-r238a6316e , EasyARCloud demo ,
Just add a simple script to instantiate object runtime when target detects and pass URL on that object script and call web request, but not getting any response and nothing happen.
I tried this script in a different scene and work perfect as aspected, but not working in EasyAR Cloud scene,
here is my instantiate code ..
var cube = Instantiate(Resources.Load("HelloAR_ImageTarget_Cloud/prefabs/AudioPlayer", typeof(GameObject)) as GameObject);
cube.GetComponent<AudioClipHandler>().url = data.contentURL;
cube.transform.parent = go.transform;
cube.GetComponent<AudioClipHandler>().StartAudio();
and here is my web request call on instantiate an object
public void StartAudio()
{
Debug.Log("URL Set By CloudRecognize : " + url);
StartCoroutine(GetAudio(url));
}
private IEnumerator GetAudio(string url)
{
Debug.Log("Start Call URL and Load AUdio ");
using (UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(url, AudioType.MPEG))
{
yield return www.SendWebRequest();
if (www.isNetworkError)
{
Debug.Log(www.error);
}
else
{
AudioClip myClip = DownloadHandlerAudioClip.GetContent(www);
source = GetComponent<AudioSource>();
source.clip = myClip;
if (source.clip != null)
{
source.Play();
source.playOnAwake = true;
}
}
}
}
But stuck after Web request not getting a response.