Music _play_music_dolby() { // objShow.SetActive(true); EventMgr.startEvent("显示关闭按钮"); Music music = MusicMgr.PlayDolby(clipDolby); EventMgr.startEvent("显示关闭按钮"); return(music); }
//filepath 绝对路径 安卓sdcard 或者PC 绝对路径 public IEnumerator LoadMusic(string filepath) { filepath = "file://" + filepath; using (var uwr = UnityWebRequestMultimedia.GetAudioClip(filepath, AudioType.UNKNOWN)) { //不卡顿的2行代码 ((DownloadHandlerAudioClip)uwr.downloadHandler).compressed = false; ((DownloadHandlerAudioClip)uwr.downloadHandler).streamAudio = true; yield return(uwr.SendWebRequest()); if (uwr.isNetworkError) { Debug.LogError(uwr.error); } else { AudioClip clip = DownloadHandlerAudioClip.GetContent(uwr); MusicMgr.PlayDolby(clip);//播放 } } }
public override void start() { AudioMgr.TurnOnMusic(); MusicMgr.PlayDolby(musicFile); isEnd = true; }