private IEnumerator StreamingLoadMusic(string directoryName, string musicName)
    {
        if (musicName == string.Empty)
        {
            yield break;
        }

        if (Constant.CompareEnv(GameEnvironment.local))
        {
            using (var request = new UnityWebRequest("File://" + MusicPath.getMusicDataPath(directoryName, musicName))) {
                var handler = new DownloadHandlerAudioClip(string.Empty, Constant.musicAudioType);

                handler.compressed      = false;
                handler.streamAudio     = true;
                request.downloadHandler = handler;

                yield return(request.SendWebRequest());

                if (request.isNetworkError || request.isHttpError)
                {
                    Debug.LogError(request.error);
                }
                else
                {
                    AudioClip loadedAudioClip = handler.audioClip;
                    loadedAudioClip.name = musicName;

                    audioSource.clip = loadedAudioClip;

                    isReady = true;
                    PlayPreview();
                }
            }
        }
        else if (Constant.CompareEnv(GameEnvironment.webGL))
        {
            ResourceRequest request = Resources.LoadAsync <AudioClip>(Constant.audioResourceDirectory + musicName);
            while (!request.isDone)
            {
                yield return(null);
            }

            audioSource.clip = request.asset as AudioClip;
            audioSource.clip.LoadAudioData();
            while (audioSource.clip.loadState != AudioDataLoadState.Loaded && audioSource.clip.loadState != AudioDataLoadState.Failed)
            {
                yield return(null);
            }

            isReady = true;
            PlayPreview();
        }
    }
    private IEnumerator LoadAudioData(string musicName, string loadName)
    {
        if (musicName == string.Empty)
        {
            yield break;
        }

        if (Constant.CompareEnv(GameEnvironment.local))
        {
            using (UnityWebRequest resource = UnityWebRequestMultimedia.GetAudioClip("File://" + MusicPath.getMusicDataPath(loadName, musicName), Constant.musicAudioType)) {
                yield return(resource.SendWebRequest());

                if (resource.isNetworkError)
                {
                    Debug.LogError(resource.error);
                }
                else
                {
                    musicSource.clip = DownloadHandlerAudioClip.GetContent(resource);
                }
            }
        }
        else if (Constant.CompareEnv(GameEnvironment.webGL))
        {
            musicSource.clip = Resources.Load(Constant.audioResourceDirectory + musicName) as AudioClip;
            musicSource.clip.LoadAudioData();
        }
    }
    public void LoadCharts()
    {
        string[] paths = StandaloneFileBrowser.OpenFolderPanel("Open MusicFile", Application.streamingAssetsPath, false);

        if (paths.Length == 0)
        {
            return;
        }
        string directoryPath = paths[0];

        string[] files         = Directory.GetFiles(directoryPath, "*" + Constant.chartExtension, SearchOption.TopDirectoryOnly);
        string   chartFilePath = string.Empty;

        if (files.Length != 0)
        {
            chartFilePath = files[0];
        }

        StreamReader reader    = new StreamReader(chartFilePath);
        string       chartJson = reader.ReadToEnd();

        reader.Close();

        MusicStruct loadStruct = JsonUtility.FromJson <MusicStruct>(chartJson);

        _musicStruct.composer      = loadStruct.composer;
        _musicStruct.musicFileName = loadStruct.musicFileName;
        _musicStruct.musicName     = loadStruct.musicName;
        _musicStruct.previewTime   = loadStruct.previewTime;
        _musicStruct.musicVolume   = loadStruct.musicVolume;

        for (int i = 0; i < musicStruct.charts.Length; i++)
        {
            _musicStruct.charts[i] = new ChartStruct();
        }

        for (int i = 0; i < loadStruct.charts.Length; i++)
        {
            int difficulty = (int)loadStruct.charts[i].difficulty;
            _musicStruct.charts[difficulty] = loadStruct.charts[i];
        }

        musicController.RemoveMusic();
        musicController.SetInputFieldText();
        chartController.SetValueToUI();
        notesController.GenerateNotesFromChart();
        timeController.SetTimeLength();
        measureController.RemoveAllMeasure();
        measureController.Init();
        timeController.SetTime(0);
        ReFreshChart();

        if (musicStruct.musicFileName == string.Empty)
        {
            return;
        }

        string musicPath = MusicPath.getMusicDataPath(Path.GetFileName(directoryPath), musicStruct.musicFileName);

        StartCoroutine(musicController.SetAudioClipFromPath(musicPath, musicStruct.musicFileName, false));
    }