Ejemplo n.º 1
0
    public void Click_btnDownloadFile()
    {
        //GcloudVoice.GcloudVoiceErrno err;
        //err = m_voiceengine.DownRecordFile (m_ShareFileID, m_downloadpath, 5000);
        //PrintLog ("download file with ret=" + err);
        //s_strLog += "\r\n download file with ret=="+err;
        //m_fileid = "306b02010004643062020100042433343664633236302d613163302d313165362d386264392d66353435376438313232353602037a1afd02047d16a3b402045826b397042033363236333939656531366162666333396561376439613238373432383135380201000201000400";
        int ret = m_voiceengine.DownloadRecordedFile(m_fileid, m_downloadpath, 60000);

        s_strLog += "\r\n download file with ret==" + ret + " fileid=" + m_fileid + " downpath" + m_downloadpath;
    }
Ejemplo n.º 2
0
 public void DownloadRecordedFile(string strShareFileID, string strFileName)
 {
     if (!string.IsNullOrEmpty(strShareFileID))
     {
         if (m_voiceengine != null)
         {
             if (m_strDownLoadingFileid.Equals(strShareFileID))
             {
                 return;
             }
             m_strDownLoadingFileid = strShareFileID;
             string filePath = string.Format("{0}/{1}.amr", VoiceDataPath, strFileName);
             if (m_GCloudVoiceMode == GCloudVoiceMode.RealTime)
             {
                 CloseMic();
                 CloseSpeaker();
                 SetModel(GCloudVoiceMode.Translation);
             }
             GCloudVoiceErr error = (GCloudVoiceErr)m_voiceengine.DownloadRecordedFile(strShareFileID, filePath, 6000);
             if (error != 0)
             {
                 SetRealTimeModel();
             }
             Debug.Log("DownloadRecordedFile error:" + error);
         }
     }
 }
Ejemplo n.º 3
0
        public void PlayVoice(string urlLocal)
        {
            AudioListener.volume = 0f;
            //找到对应位置的语音动画播放
            PlayerPlayingPanelData pppd = GameData.Instance.PlayerPlayingPanelData;
            //  Debug.LogWarning("玩家index:" + (pppd.GetOtherPlayerShowPos(pppd.GetOtherPlayerPos(voices[0].iUserId)) - 1));
            int index = pppd.GetOtherPlayerShowPos(pppd.GetOtherPlayerPos(voices[0].iUserId)) - 1;

            UIMainView.Instance.PlayerPlayingPanel._playingHead[index].GetChild(4).GetComponent <Animator>().SetBool("isPlayOthers", true);
            //Debug.LogWarning("动画没问题");
            string ext = DateTime.Now.ToFileTime().ToString();

            if (VoiceFlag == 1)
            {
                string[]      pathSplit     = voices[0].szRecordUrlPath.Split('/');
                string        localFilePath = isExistGvoiceFile(MahjongLobby_AH.SDKManager.DataPath) + pathSplit[pathSplit.Length - 1];
                int           downLoadErr   = m_voiceengine.DownloadRecordedFile(ByteArrayToHexString(voices[0].id), localFilePath, 6000);
                ShortTalkData std           = GameData.Instance.ShortTalkData;
                if (!std._DownLoadFilePath.ContainsKey(voices[0].szRecordUrlPath))
                {
                    std._DownLoadFilePath.Add(voices[0].szRecordUrlPath, localFilePath);
                    Debug.LogWarning("下载地址1:" + voices[0].szRecordUrlPath);
                }
                Debug.LogWarning("下载地址2:" + localFilePath);

                m_voiceengine.OnPlayRecordFilComplete += (code, filePath) =>
                {
                    if (code != IGCloudVoice.GCloudVoiceCompleteCode.GV_ON_PLAYFILE_DONE)
                    {
                        Debug.Log("OnPlayRecordFilComplete error" + code);
                    }
                    else
                    {
                        Chenggong = true;
                        StartCoroutine(CompeletPlay());
                    }
                };
                ErroOccur(downLoadErr, () => { StartCoroutine(CompeletPlay()); });
            }
            else
            {
                YunVaImSDK.instance.RecordStartPlayRequest(urlLocal, voices[0].szRecordUrlPath, ext, (data2) =>
                {
                    Debug.LogWarning("data2.result:" + data2.result + "Chenggong:" + Chenggong);
                    if (data2.result == 0)
                    {
                        Chenggong = true;
                        StartCoroutine(CompeletPlay());
                    }
                    else
                    {
                        VoiceInit();
                        // StartCoroutine(CompeletPlay());
                        //Debug.LogWarning("播放失败");//关静音
                        Debug.LogWarning(voices[0].szRecordUrlPath);
                        MahjongCommonMethod.Instance.ShowRemindFrame("语音播放失败", true);
                    }
                });
            }
        }
Ejemplo n.º 4
0
 public void Click_btnDownloadFile(string fileid = null, CallBack _downCall = null, CallBack _playCall = null)
 {
     if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer)
     {
         downCall = _downCall;
         playCall = _playCall;
         //GcloudVoice.GcloudVoiceErrno err;
         //err = m_voiceengine.DownRecordFile (m_ShareFileID, m_downloadpath, 5000);
         //PrintLog ("download file with ret=" + err);
         //s_strLog += "\r\n download file with ret=="+err;
         //m_fileid = "306b02010004643062020100042433343664633236302d613163302d313165362d386264392d66353435376438313232353602037a1afd02047d16a3b402045826b397042033363236333939656531366162666333396561376439613238373432383135380201000201000400";
         if (!string.IsNullOrEmpty(fileid))
         {
             m_fileid = fileid;
         }
         int ret = m_voiceengine.DownloadRecordedFile(m_fileid, m_downloadpath, 60000);
     }
 }
Ejemplo n.º 5
0
    public void Click_btnDownloadFile(string fileid)
    {
        //GcloudVoice.GcloudVoiceErrno err;
        //err = m_voiceengine.DownRecordFile (m_ShareFileID, m_downloadpath, 5000);
        //PrintLog ("download file with ret=" + err);
        //s_strLog += "\r\n download file with ret=="+err;
        // DownloadRecordedFile
        int ret = m_voiceengine.DownloadRecordedFile(fileid, m_downloadpath, 60000);

        s_strLog += "\r\n download file with ret==" + ret + " fileid=" + m_fileid + " downpath" + m_downloadpath;
    }
Ejemplo n.º 6
0
 void downloadRecord()
 {
     if (isPlaySucc && records.Count > 0)
     {
         isPlaySucc = false;
         string         recordID = records.Dequeue();
         GCloudVoiceErr err      = (GCloudVoiceErr)m_voiceengine.DownloadRecordedFile(recordID, downloadPath, 60000);
         if (err != GCloudVoiceErr.GCLOUD_VOICE_SUCC)
         {
             Debug.LogError("[GVoiceMng.StopRecording]UploadRecordedFile:" + err);
             isPlaySucc = true;
             downloadRecord();
         }
     }
 }
Ejemplo n.º 7
0
    public void DownloadRecordedFile(string fileid, string downLoadPath, int num)
    {
        int ret = mVoiceengine.DownloadRecordedFile(fileid, downLoadPath, num);

        Debug.Log("\r\n download file with ret==" + ret + " fileid=" + fileid + " downpath" + downLoadPath);
    }
Ejemplo n.º 8
0
 public void DownloadFile(string file_id)
 {
     mVoiceEngine.DownloadRecordedFile(file_id, mDownloadPath, 6000);
 }