Solved

Trackbar and mediaplayer

Posted on 1997-11-11
5
358 Views
Last Modified: 2010-05-18
hi,

how do I get the trackbar to display the playing time when opening a mediafile, and when starting to play, to update the trackbar to the playing position.
0
Comment
Question by:hellfire052497
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 3

Accepted Solution

by:
Pegasus100397 earned 150 total points
ID: 1349939
Hellfire, try this:

Trackbar1.Position := MediaPlayer1.Position

Good luck with your project!
Pegasus

P.S. You may also have to set the start and end positions (min/max) of the trackbar to correspond with how many "frames", etc are in the media file.
0
 
LVL 3

Expert Comment

by:Pegasus100397
ID: 1349940
side note: MediaPlayer1.Position is a a time value. Depending on what time values you want (minutes, seconds, etc) you will have to do some time juggling to get the trackbar to sync with the mediaplayer. Also, use a TTimer (about 1 sec) apart to set the trackbar position.

If you just need to indicate what track it's on, use MediaPlayer1.Trackposition.
0
 

Author Comment

by:hellfire052497
ID: 1349941
I have decided to use a progressbar, Now this is used different then Trackbar so could you please explain how to use this, when searching in help it says to look at StepIt, but when I click on the example button I get an error saying not found, so help!!
and also, when mediaplayer is open how do I close it? I tried
If MediaPlayer1 := open then Mediaplayer1.close; but it didn't work. it is the first time I use MediaPlayer and a progressbar.
thanks.
0
 
LVL 3

Expert Comment

by:Pegasus100397
ID: 1349942
Hellfire, what type of media are you playing with the media player? .WAV files? CDs? Curious because the routines are a little different for each.

The StepIt method is used as follows:
ProgressBar1.StepIt;

It's just a convienient way to increment the progress bar. Each call to StepIt will increment the progress bar the amount of the Step property.

to Stop the Mediaplayer issue Mediaplayer1.Stop

to actually make it "go away" (hide it, but leave it available) issue Mediaplayer1.Visible := False;

regards,
Pegasus
0
 

Author Comment

by:hellfire052497
ID: 1349943
with the Mediaplayer1.stop I know how to call it, but how do I check if MediaPlayer1.open is true and if so then to close it.
and also vice versa.

The idea was to make a general mediaplayer, so that it would play all supported files. (I use the autoselect for mediatype)

And how to use that progressbar?
if I open a file, I should set the min tracktime as 0 and the max tracktime as 100 for the progressbar, and when starting to play to increment the progressbar, probably with a timer.
But I have no idea how to make this, could you give a small example??
Thanks


0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

724 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