public void Click_GetRecFileParam() { int[] bytes = new int[1]; bytes[0] = 0; float[] seconds = new float[1]; seconds[0] = 0; m_voiceengine.GetFileParam(m_recordpath, bytes, seconds); s_strLog += "\r\nfile:" + m_recordpath + "bytes:" + bytes[0] + " seconds:" + seconds[0]; }
public void Click_GetRecFileParam() { if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer) { int[] bytes = new int[1]; bytes[0] = 0; float[] seconds = new float[1]; seconds[0] = 0; m_voiceengine.GetFileParam(m_recordpath, bytes, seconds); PlayLog("\r\nfile:" + m_recordpath + "bytes:" + bytes[0] + " seconds:" + seconds[0]); } }
public uint GetRecFileSecond(string fileid) { int[] bytes = new int[1]; bytes[0] = 0; float[] seconds = new float[1]; seconds[0] = 0; string record_path = GenFilePathByFileId(fileid); mVoiceEngine.GetFileParam(record_path, bytes, seconds); uint ret = 1; if (seconds.Length > 0) { ret = (uint)seconds[0]; if (ret == 0) { ret = 1; } } return(ret); }
/// <summary> /// 当录制完成后,调用UploadRecordedFile将文件上传到GcloudVoice的服务器上, /// 该过程会通过OnUploadReccordFileComplete回调在上传成功的时候返还一个ShareFileID.该ID是这个文件的唯一标识符, /// 用于其他用户收听时候的下载。服务器需要对其进行管理和转发 /// </summary> public void UploadRecordedFile() { if (!string.IsNullOrEmpty(m_filePath)) { int[] bytes = new int[1]; bytes[0] = 0; float[] seconds = new float[1]; seconds[0] = 0; if (m_GCloudVoiceMode != GCloudVoiceMode.Translation) { SetModel(GCloudVoiceMode.Translation); } m_voiceengine.GetFileParam(m_filePath, bytes, seconds); Debug.Log("GVoiceManger UploadRecordedFile m_filePath:" + m_filePath + " seconds :" + seconds[0]); if (seconds[0] <= 0) { TipsManager.Instance.ShowTips("输入语音过短"); SetRealTimeModel(); return; } GCloudVoiceErr error = (GCloudVoiceErr)m_voiceengine.UploadRecordedFile(m_filePath, 6000); if (error != GCloudVoiceErr.GCLOUD_VOICE_SUCC) { TipsManager.Instance.ShowTips("语音发送成功"); SetRealTimeModel(); } Debug.Log("GVoiceManger UploadRecordedFile error:" + error); } else { SetRealTimeModel(); } }