Solved

How to know if MediaPlayer opened or closed the file?

Posted on 2014-09-24
8
298 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
Comment Utility
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
Comment Utility
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
Comment Utility
What kind of file are you playing, audio, video, etc?
0
 
LVL 1

Author Comment

by:hidrau
Comment Utility
Audio file
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 19

Expert Comment

by:MerijnB
Comment Utility
0
 
LVL 1

Author Comment

by:hidrau
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks very much
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
ADO Memory leak with DELPHI 2007 37 153
TcomboBox uninverted item 3 44
find a node in VST 2 46
Convert a string into a TDateTime 5 44
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

728 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now