Google Groups unterstützt keine neuen Usenet-Beiträge oder ‑Abos mehr. Bisherige Inhalte sind weiterhin sichtbar.

MediaPlayer

42 Aufrufe
Direkt zur ersten ungelesenen Nachricht

Alexander Pareski

ungelesen,
21.12.2000, 08:49:3521.12.00
an
Hello,

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


Alex Bakaev

ungelesen,
21.12.2000, 15:49:5221.12.00
an
This question should be asked in the .vcl.using as that's the place with
the best chances of getting an answer.

.a

Martin Stainsby

ungelesen,
21.12.2000, 17:15:1921.12.00
an
Note the MediaPlayer->DisplayRect.Right and Bottom
reading these will give the width and height of the full size video.
writing will set the new size for the video display.

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();
}
}

0 neue Nachrichten