[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.6

.AVI Files in TMediaPlayer play WAY too fast.

Asked by unfunf in Delphi Programming

Tags: tmediaplayer, fast, mediaplayer1

Alright. I have been designing a media player using the TMediaPlayer component. Getting it to display the .avi file graphics on a TPanel and other such "challenges" were easy enough to overcome; however, when I load up a .avi file and press play, two things happen:
1. The .avi file plays VERY fast, going through frames as fast as the program can handle I assume.
2. There is no sound (probably because it's playing so fast though).

I looked through a bunch of tutorials and they all say just do MediaPlayer1.Open then MediaPlayer1.Play, even for .avi files... So, I do not understand why my .avi files go through the frames so quickly, finishing a 23 minute .avi video in less than a minute...


This is the code:

[code]
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, MPlayer, XPMan, StdCtrls, ExtCtrls, ComCtrls;

type
  TForm1 = class(TForm)
    MediaPlayer1: TMediaPlayer;
    XPManifest1: TXPManifest;
    LabeledEdit1: TLabeledEdit;
    Button1: TButton;
    OpenDialog1: TOpenDialog;
    Panel1: TPanel;
    StatusBar1: TStatusBar;
    Timer1: TTimer;
    procedure Button1Click(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  if OpenDialog1.Execute then
  begin
    LabeledEdit1.Text := OpenDialog1.FileName;
    MediaPlayer1.FileName := OpenDialog1.FileName;
    if (LowerCase(ExtractFileExt(OpenDialog1.FileName)) = '.avi') or
       (LowerCase(ExtractFileExt(OpenDialog1.FileName)) = '.mpg') or
       (LowerCase(ExtractFileExt(OpenDialog1.FileName)) = '.mpeg') or
       (LowerCase(ExtractFileExt(OpenDialog1.FileName)) = '.mov') then
    begin
      MediaPlayer1.Display := Panel1;
      MediaPlayer1.Open;
      MediaPlayer1.DisplayRect := rect(0, 0, panel1.width, panel1.height);
      Timer1.Enabled := True;
    end else
    begin
      MediaPlayer1.Open;
      Timer1.Enabled := False;
    end;
  end;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
var
  TotLen, CurPos, PerComp, FPS: Extended;
begin
  MediaPlayer1.TimeFormat := tfMilliseconds;
  TotLen := (MediaPlayer1.Length / 1000) / 60;
  CurPos := (MediaPlayer1.Position / 1000) / 60;
  PerComp := (100 * (CurPos / TotLen));
  FPS :=  (MediaPlayer1.Frames / (MediaPlayer1.Length / 1000));
  StatusBar1.SimpleText := 'Total Length (minutes): '+FloatToStrF(TotLen, ffGeneral, 5, 2)+' | Current Position (minutes): '+FloatToStrF(CurPos, ffGeneral, 5, 2)+' | Percent Complete: %'+IntToStr(Round(PerComp))+' | Frames: '+IntToStr(MediaPlayer1.Frames)+' | FPS: '+IntToStr(Round(FPS));
  StatusBar1.Update;
end;

end.
[/code]
[+][-]07/14/04 10:14 PM, ID: 11556108Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/15/04 10:28 AM, ID: 11561214Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/25/04 06:19 AM, ID: 11631696Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: Delphi Programming
Tags: tmediaplayer, fast, mediaplayer1
Sign Up Now!
Solution Provided By: evil-tech
Participating Experts: 2
Solution Grade: A
 
[+][-]07/25/04 03:24 PM, ID: 11633599Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/26/04 07:15 AM, ID: 11637505Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/26/04 09:27 AM, ID: 11638911Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/27/04 11:40 PM, ID: 11653914Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/15/05 12:18 AM, ID: 13311639Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]02/19/05 12:39 AM, ID: 13352469Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-89