i use the BCB 3.0 prof. and insert an MediaPlayer Component in my Project.
Is it possible to get the Height ad Width of the playing Video and to Chage
it? So that i can show a Video in FullScreen or so.. .
I found the Command MediaPlayr1->Display->Width, but if I use this, i one
error after Compiling.
cu
Alexander
.a
eg. MediaPlayer->DisplayRect->Right = 320;
MediaPlayer->DisplayRect->Bottom = 240;
you will need to read first to calculate the aspect ratio otherwise the
video will be distorted
The following code is a working example of a stretched media player
keeping the aspect ratio intact
Start a new application
put a button, panel, and media player onto the form
set the panel and media players visible property to false
then put the code below into the buttons onclick event
then run the app.
void __fastcall TForm1::Button1Click(TObject *Sender)
{
TRect r;
Panel1->Visible = false; // This hides the video resize
OpenDialog1->FileName = "*.avi"; // You can use any valid extention
if (OpenDialog1->Execute())
{
MediaPlayer1->FileName = OpenDialog1->FileName;
}
MediaPlayer1->DeviceType = dtAutoSelect;
MediaPlayer1->Display = Panel1;
MediaPlayer1->Open();
try
{
float width = MediaPlayer1->DisplayRect.Right;
float height = MediaPlayer1->DisplayRect.Bottom;
float Proportion = width / height;
int VideoSize = 150; // video will display at this size
if(width >= height)
{
r.right = VideoSize;
r.bottom = VideoSize / Proportion;
}
else{ r.bottom = VideoSize * Proportion;
r.right = VideoSize; }
r.left = 0;
r.top = 0;
MediaPlayer1 -> DisplayRect = r;
Panel1->Visible = true;
MediaPlayer1->Wait = true;
MediaPlayer1->Play();
}
__finally
{
MediaPlayer1->Close();
}
}