Fórum Contruindo um Media Player #383446
11/08/2010
0
Ola,
Estou precisando terminar um Media Player para entregar na faculdade onde estudo, gostaria de uma ajudar de alguem pois não encontrei artigos que explicasse corretamente como fazer para aparecer o tempo do video, fazer esse tempo andar do zero até o tempo máximo dele e fazer que a trackbar acompanhasse esse tempo.
O video que estou usando tem a duração de 00:21:12.
Abaixo alguns codigos que estou usando:
Botão Abrir Video:
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
if opendialog1.execute then
begin
mediaplayer1.TimeFormat := tfFrames;
mediaplayer1.filename:= opendialog1.filename;
caption := caption + ' - ' + opendialog1.filename;
mediaplayer1.open;
mediaplayer1.Perform (wm_lbuttondown,0,$00090009);
mediaplayer1.Perform (wm_lbuttonup,0,$00090009);
mediaplayer1.DisplayRect := Rect(10,10, Panel1.Width-20,Panel1.Height-20);
trackbar1.Max := mediaplayer1.Frames;
tempo;
end;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if MediaPlayer1.Frames > 0 then
TrackBar1.Position := MediaPlayer1.Position;
end;
procedure TForm1.TrackBar1Change(Sender: TObject);
begin
mediaplayer1.StartPos := trackbar1.Position;
mediaplayer1.Play;
end;
procedure TForm1.tempo;
var Min, Sec : double;
MinSec : String;
begin
Min := (MediaPlayer1.Frames div 100) div 60;
Sec := (MediaPlayer1.Frames div 100) mod 60;
Edit1.Text := FormatFloat('00:00', StrToInt(FloatToStr(min))+ StrToInt(FloatToStr(sec)));
end;
Alguem por favor porderia me ajudar?
Estou precisando terminar um Media Player para entregar na faculdade onde estudo, gostaria de uma ajudar de alguem pois não encontrei artigos que explicasse corretamente como fazer para aparecer o tempo do video, fazer esse tempo andar do zero até o tempo máximo dele e fazer que a trackbar acompanhasse esse tempo.
O video que estou usando tem a duração de 00:21:12.
Abaixo alguns codigos que estou usando:
Botão Abrir Video:
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
if opendialog1.execute then
begin
mediaplayer1.TimeFormat := tfFrames;
mediaplayer1.filename:= opendialog1.filename;
caption := caption + ' - ' + opendialog1.filename;
mediaplayer1.open;
mediaplayer1.Perform (wm_lbuttondown,0,$00090009);
mediaplayer1.Perform (wm_lbuttonup,0,$00090009);
mediaplayer1.DisplayRect := Rect(10,10, Panel1.Width-20,Panel1.Height-20);
trackbar1.Max := mediaplayer1.Frames;
tempo;
end;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if MediaPlayer1.Frames > 0 then
TrackBar1.Position := MediaPlayer1.Position;
end;
procedure TForm1.TrackBar1Change(Sender: TObject);
begin
mediaplayer1.StartPos := trackbar1.Position;
mediaplayer1.Play;
end;
procedure TForm1.tempo;
var Min, Sec : double;
MinSec : String;
begin
Min := (MediaPlayer1.Frames div 100) div 60;
Sec := (MediaPlayer1.Frames div 100) mod 60;
Edit1.Text := FormatFloat('00:00', StrToInt(FloatToStr(min))+ StrToInt(FloatToStr(sec)));
end;
Alguem por favor porderia me ajudar?
Wilton Júnior
Curtir tópico
+ 0
Responder
Clique aqui para fazer login e interagir na Comunidade :)