I am trying to stream music from either the computer or the Internet for my game. I wrote the follow script but I cannot get either to work. I have the AudioSource and AudioListener in my scene. I checked that the song I am trying to play is mp3 and all Grooveshark songs are mp3.
using UnityEngine;
using System.Collections;
public class streamer : MonoBehaviour {
public string internetmusic = "http://grooveshark.com/#!/s/You+Suffer/6IDpiD?src=5";
public string filemusic = "W:/Music/Childish Gambino/Because The Internet/01 The Library (Intro)";
void Start () {
WWW music = new WWW (internetmusic); //also tried with filemusic
audio.clip = music.GetAudioClip (false, true, AudioType.MPEG);
audio.Play ();
}
}
0 comments:
Post a Comment