Solved

Trackbar and mediaplayer

Posted on 1997-11-11
5
356 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

Independent Software Vendors: 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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

733 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