![]() |
|
كيف أضع ملف الصوت داخل التطبيق مع السورس - نسخة قابلة للطباعة +- delphi4arab منتديات دلفي للعرب (https://delphi4arab.net/forum) +-- قسم : منتديات دلفي للعرب التعليمية (https://delphi4arab.net/forum/forumdisplay.php?fid=3) +--- قسم : سؤال و جواب حول دلفي (https://delphi4arab.net/forum/forumdisplay.php?fid=15) +--- الموضوع : كيف أضع ملف الصوت داخل التطبيق مع السورس (/showthread.php?tid=8022) الصفحات:
1
2
|
RE: كيف أضع ملف الصوت داخل التطبيق مع السورس - jeanjamil - 21-07-2016 public
{ Public declarations } procedure PlayAudio_android(myresource: string); end; var Form3: TForm3; switch:boolean=false; i:integer; implementation {$R *.fmx} {$R *.SmXhdpiPh.fmx ANDROID} procedure TForm3.Button2Click(Sender: TObject); begin MediaPlayer1.Stop; end; procedure TForm3.Button3Click(Sender: TObject); begin i:=1; ;(PlayAudio_android('Resource_1 end; procedure TForm3.PlayAudio_android(myResource: string); var Stream: TResourceStream; myfile: string; begin Stream := TResourceStream.Create(HInstance, myresource, RT_RCDATA); try case i of 1: myfile := TPath.Combine(TPath.GetDocumentsPath, 'Track1.mp3') ; //your resource_1 2: myfile := TPath.Combine(TPath.GetDocumentsPath, 'mou3inewadih.3gp'); //your resource_2 end; Stream.Position := 0; Stream.SaveToFile(myfile); MediaPlayer1.FileName := myfile; MediaPlayer1.Play; finally Stream.Free; end; end; procedure TForm3.Button1Click(Sender: TObject); begin i:=2; PlayAudio_android('Resource_2'); end; end. RE: كيف أضع ملف الصوت داخل التطبيق مع السورس - Programmerstn - 21-07-2016 (21-07-2016, 08:29 PM)jeanjamil كتب : Stream := TResourceStream.Create(HInstance, myresource, RT_RCDATA);شكرا لك أخي جزاك الله خير اشتغل معايه بطريقة هذي http://community.embarcadero.com/blogs/entry/playing-audio-clips-on-android-366 |