public void PlayOrDownload(string file_id) { var path = GenFilePathByFileId(file_id); if (File.Exists(path)) { mVoiceEngine.PlayRecordedFile(path); } else { DownloadFile(file_id); } }
public void Click_btnPlayReocrdFile() { if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer) { int err; if (false && m_ShareFileID == null) { //UnityEditor.EditorUtility.DisplayDialog("", "you have not download record file ,we will play local record files", "OK"); err = m_voiceengine.PlayRecordedFile(m_recordpath); return; } err = m_voiceengine.PlayRecordedFile(m_downloadpath); //m_voiceengine.PlayRecordedFile (m_downloadpath); } }
/// <summary> /// 当游戏客户端需要收听其他人的录音时, /// 首先从服务器获取转发的ShareFileID,然后调用DownloadRecordedFile下载该语言文件, /// 下载结果通过OnDownloadRecordFileComplete回调来通知 /// </summary> /// <param name="code"></param> /// <param name="filepath"></param> /// <param name="fileid"></param> public void OnDownloadRecordFileCompleteHandler(IGCloudVoice.GCloudVoiceCompleteCode code, string filepath, string fileid) { Debug.Log(string.Format(" GVoiceManger 收听语音回调 {0} / {1} / {2}", code, filepath, fileid)); if (code == IGCloudVoice.GCloudVoiceCompleteCode.GV_ON_DOWNLOAD_RECORD_DONE) { if (m_voiceengine != null) { if (code == IGCloudVoice.GCloudVoiceCompleteCode.GV_ON_DOWNLOAD_RECORD_DONE) { m_bPlayRecordFile = true; m_strDownLoadingFileid = ""; if (m_GCloudVoiceMode == GCloudVoiceMode.RealTime) { SetModel(GCloudVoiceMode.Translation); } int ret = m_voiceengine.PlayRecordedFile(filepath); if (ret != 0) { SetRealTimeModel(); } } } } else { SetRealTimeModel(); } }
public void PlayRecordedFile(string downloadPath) { int err; err = mVoiceengine.PlayRecordedFile(downloadPath); Debug.Log("playrecord file with ret=" + err); }
void Start() { if (MahjongCommonMethod.Instance.isVoiceHandler) { return; } MahjongCommonMethod.Instance.isVoiceHandler = true; m_voiceengine.OnApplyMessageKeyComplete += (code) => { Debug.Log("OnApplyMessageKeyComplete ret=" + code); if (code == IGCloudVoice.GCloudVoiceCompleteCode.GV_ON_MESSAGE_KEY_APPLIED_SUCC) { Debug.Log("OnApplyMessageKeyComplete succ"); } else { Debug.Log("OnApplyMessageKeyComplete error"); } }; m_voiceengine.OnDownloadRecordFileComplete += (code, url, id) => { if (code == IGCloudVoice.GCloudVoiceCompleteCode.GV_ON_DOWNLOAD_RECORD_DONE) { int downLoadErr = m_voiceengine.PlayRecordedFile(url); ErroOccur(downLoadErr, null); } else { Debug.Log("OnDownloadRecordFileComplete error" + code); } }; }
public void Click_btnPlayReocrdFile() { int err; if (false && m_ShareFileID == null) { //UnityEditor.EditorUtility.DisplayDialog("", "you have not download record file ,we will play local record files", "OK"); err = m_voiceengine.PlayRecordedFile(m_recordpath); PrintLog("downloadpath is nill, play local record file with ret=" + err); return; } err = m_voiceengine.PlayRecordedFile(m_downloadpath); PrintLog("playrecord file with ret=" + err); //m_voiceengine.PlayRecordedFile (m_downloadpath); }
// Update is called once per frame void Update() { string fiedID; string uuid; if (_fileIDArr != null) { if (isCanPlayRecordedFile && _fileIDArr.Count > 0 && _voicePlayerSwitch) { try { isCanPlayRecordedFile = false; fiedID = _fileIDArr[0] as string; uuid = _fileIDDicUUid[fiedID]; _fileIDArr.RemoveAt(0); _fileIDDicUUid.Remove(uuid); if (uuid == MainManager.Instance.playerSelfInfo.unionID) { m_voiceengine.PlayRecordedFile(m_recordpath); } else { Click_btnPlayReocrdFile(fiedID); } // EventDispatcher.GetInstance().UIFrameWorkEventManager.TriggerEvent<string>(EventId.UIFrameWork_Bug, "playone"); EventDispatcher.GetInstance().UIFrameWorkEventManager.TriggerEvent <string, bool>(EventId.UIFrameWork_Set_Voice_Active, uuid, true); } catch (System.Exception) { EventDispatcher.GetInstance().UIFrameWorkEventManager.TriggerEvent <string>(EventId.UIFrameWork_Bug, "_fileIDDicUUid.erro"); } } } m_logText.text = s_strLog; }
void onDownloadReccordFileComplete(IGCloudVoice.GCloudVoiceCompleteCode code, string filepath, string fileid) { if (code == IGCloudVoice.GCloudVoiceCompleteCode.GV_ON_DOWNLOAD_RECORD_DONE) { Debug.Log("OnDownloadRecordFileComplete succ, filepath:" + filepath + " fileid:" + fileid); GCloudVoiceErr err = (GCloudVoiceErr)m_voiceengine.PlayRecordedFile(filepath); if (err != GCloudVoiceErr.GCLOUD_VOICE_SUCC) { Debug.LogError("[GVoiceMng.onDownloadReccordFileComplete]PlayRecordedFile:" + err); isPlaySucc = true; downloadRecord(); } } else { Debug.Log("OnDownloadRecordFileComplete error"); } }