本文整理自网络,侵删。
Stream : TMemoryStream;begin Stream := TMemoryStream.Create;
try IdHTTP1.Request.UserAgent := 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) Gecko/20100401';
IdHTTP1.Get(TIdURI.URLEncode('http://translate.google.com/translate_tts?tl=ko&q=' + txtHangul.Text), Stream); finally MediaPlayer1.Close; Stream.SaveToFile(ExtractFilePath(Application.ExeName) + 'temp.mp3');
MediaPlayer1.FileName := ExtractFilePath(Application.ExeName) + 'temp.mp3'; MediaPlayer1.Open; MediaPlayer1.Play; end;end;
相关阅读 >>
Delphi 通过twebbrowser文档中的id查找html元素
Delphiwindows 下编译 exe 文件时把一个外部 txt 文件编译到 exe 里面
Delphi中使用goo.gl(google的缩短url服务)api
更多相关阅读请进入《Delphi》频道 >>