Has anybody got any sample code for using the Media Player facilities
in Borland C++ Builder? Any help would be most appreciated.
Or is there any www sites anyone can recommend for finding such sample
code?
Many Thanks,
Mark
first set some property to the mediaplayer :
FileName = "sample.mpg";
AutoOpen = true;
Display = panA;
.........
and on the form events "OnShow" or "OnActivate" or when you need it you
can add this :
medA->DisplayRect = panA->ClientRect;
and if you want to access the position of the MPG with a TrackBar you can
add :
TrackBar->Position = medA->Position;
and on the "OnChange" of the TrackBar :
medA->Position = TrackBar->Position;
and you have all the others methods like :
medA->Paly();
medA->Stop(); .....
and if you want to make a kind of zoom you can put your panel in a
scrollBox and do something like :
panA->Width = panA->Width * 2;
panA->Height = panA->Height * 2;
medA->DisplayRect = panA->ClientRect;
.....
hope that will help ;-)
Jean (sorry for my bad english) Darveau
>>> SNIPPED <<<
Many Thanks, that got me started. Thankyou.
>and if you want to access the position of the MPG with a TrackBar you can
>add :
>
>TrackBar->Position = medA->Position;
Where should that be put though? Which part of the code is looped
continuously until the program is exited?
>hope that will help ;-)
A great deal, thankyou.
Thanks,
Mark
;-)
you are welcome
and just by curiosity what "snipped" means ?
Jean (sorry for my bad english) Darveau
>>With the TMediaPlayer (i could be wrong) but the only way that i know is
to
add a timer with a 30 miliseconds loop
Just to clarify, the regular Windows system timer has a resolution of no
better than 55ms or so (TTimer uses a system timer). If you want to get
resolution below 55ms you must use the multimedia timers.
--
Kent (TeamB and TurboPower Software)
Jean (sorry for my bad english) Darveau
I have resolved the Timer problem.
Thanks again.
Mark
mark...@overflow.com.NOSPAM (Mark) wrote:
>Hi,
>
>Okay...
>
>I am very new to C++ Builder programming. I have used C++ for dos for
>many years, and do not understand what replaces the:
>
>void main (void)
>{
>}
>
>segment of code?
>
>
>
>Here is the relevant part of my C++ Builder program :-
>
>
>//---------------------------------------------------------------------------
>#include <vcl\vcl.h>
>#pragma hdrstop
>
>#include "Unit1.h"
>#include "Unit2.h"
>
>#include "string.h"
>//---------------------------------------------------------------------------
>#pragma resource "*.dfm"
>TForm1 *Form1;
>
>//---------------------------------------------------------------------------
>__fastcall TForm1::TForm1(TComponent* Owner)
> : TForm(Owner)
>{
>}
>//---------------------------------------------------------------------------
>void __fastcall TForm1::ExitClick(TObject *Sender)
>{
> exit (EXIT_SUCCESS);
>}
>//---------------------------------------------------------------------------
>void __fastcall TForm1::UpdateVideoPos(TObject *Sender)
>{
> MediaPlayer1->Position = VideoTrackBar->Position;
>}
>//---------------------------------------------------------------------------
>void __fastcall TForm1::AboutMenu2Click(TObject *Sender)
>{
> TAbout *About;
> About = new TAbout(Application);
> About->ShowModal();
> delete About;
>}
>//---------------------------------------------------------------------------
>
>
>Where would I add this timer? And how would it be added?
>Unfortunately, I could not find any programs in the Borland Examples
>which used the trackbars.
>
>
>Snipped, basically means "bits removed". To save quoting the entire
>message again, I removed bits which were no-longer important to my
>reply to keep the messages short.
>
>
>Thanks again,
>
>Mark
>
>
>
>
>Jean Darveau <jean.d...@msi.qc.ca> wrote:
>
>>With the TMediaPlayer (i could be wrong) but the only way that i know is to
>>add a timer with a 30 miliseconds loop if your avi or mpg is a 30
>>images/seconds, and you could start and stop your timer on the onClick event
>>of you Mediaplayer buttons.
>>
>>;-)
>>
>>you are welcome
>>
>>and just by curiosity what "snipped" means ?
>>
>>Jean (sorry for my bad english) Darveau
>>
>>
>>
>>
> Just to clarify, the regular Windows system timer has a resolution of
> no
> better than 55ms or so (TTimer uses a system timer). If you want to
> get
> resolution below 55ms you must use the multimedia timers.
There's a Delphi component called 'HiresTimer' which gives you a 1 ms
resolution using the MCI timers. I use it in BCB1 and BCB3 and it works
great. On the 'outside' it works the same as the normal timer component,
but it's much more reliable and it seems very stable. It's freeware too.
Mail me if you're interested.
Richard van Meurs(vanmeu...@atriserv.nl)