Solved

How to know if MediaPlayer opened or closed the file?

Posted on 2014-09-24
8
310 Views
Last Modified: 2014-09-25
Hello guys,

I use the component MediaPlayer and I'd like to know if my mediaplayer opened and is ready to play a file, is there a way to know about? Or if it closed the file that it was playing.

I tried to use this without opening any file to know it my mediaplayer is close or without any file ready to play.

  if MediaPlayer1.Mode = mpNotReady Then
  Begin
    ShowMessage('Not ready');
  End;

But it seems that this mpNotReady doesn't work as it should.


Thanks
Alex
0
Comment
Question by:hidrau
  • 4
  • 4
8 Comments
 
LVL 19

Expert Comment

by:MerijnB
ID: 40343329
To be honest, I've stopped using TMediaPlayer long ago because I kept running into small annoying things. What is it you are trying to play?
0
 
LVL 1

Author Comment

by:hidrau
ID: 40343384
hummm,

What are you using now ?

My problem is to know if my mediaplayer is ready to play a file.

If I don't pass a file name to it and open it, it is in some ""state"" that I don't know, I need to get this state,

did you get it?
0
 
LVL 19

Expert Comment

by:MerijnB
ID: 40343426
What kind of file are you playing, audio, video, etc?
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 1

Author Comment

by:hidrau
ID: 40343429
Audio file
0
 
LVL 19

Expert Comment

by:MerijnB
ID: 40343459
0
 
LVL 1

Author Comment

by:hidrau
ID: 40343552
Merinjb,

I need to use MediaPlayer because I have many kind of controls with it and my form.

My problem is being only that, to know how is the state of it.

there is an option that It isn't work or I don't know how to work correctly with it, it is mpNotReady .

If I don't open a file with it to play, what state of my mediaplayer is? I noticed that all Mediaplayer buttons is enabled = false, then, there must be a way to get the state of it when it is with all buttons false.
0
 
LVL 19

Accepted Solution

by:
MerijnB earned 500 total points
ID: 40343571
How about if you change the code in your first post to this:

if (not (MediaPlayer1.Mode in [Low(TMPModes)..High(TMPModes)])) or (MediaPlayer1.Mode = mpNotReady) Then
Begin
  ShowMessage('Not ready');
End;

Open in new window


* edited the post since I made a mistake
0
 
LVL 1

Author Closing Comment

by:hidrau
ID: 40344894
Thanks very much
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

775 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question