Mp3 Player Slider Position update issue
-
Tuesday, January 24, 2012 8:52 AM
How to update slider position automatically
please help me on this issue
progress bar is working correctly but not slider
GameWindow.Width = 500
GameWindow.Height = 400
GameWindow.CanResize = "False"
GameWindow.Show()
Slider_Progress_Bar = GameControls.AddProgressBar(0,70,200,330,22)
Slider = GameControls.AddSlider(0,70,200,330,25)
Play = GameControls.AddButton("Play",250-35,250-25,70,50)
Next = GameControls.AddButton("Next",295,250-17.5,80,35)
Prev = GameControls.AddButton("Prev",125,250-17.5,80,35)
Player = Media.CreateMediaPlayer("C:\Users\Home\Music\Music\1.mp3",0,0,0,0)
GameControls.RegisterValueChangedEvent(Slider,"Possition_Change")
GameControls.RegisterMouseDownEvent(Play,"Play_Song")
Sub Play_Song
Media.Play(Player)
EndSub
Sub Possition_Change
Media_Lenth = Media.GetLength(Player)
Media_Possition = Media.GetPosition(Player)
Real_Time_Possition = (Media_Possition*100)/Media_Lenth
Media.SetPosition(Player,(GameControls.GetValue(Slider)*Media_Lenth)/100)
EndSub
While(Media_Possition<>Media_Lenth)
Media_Lenth = Media.GetLength(Player)
Media_Possition = Media.GetPosition(Player)
Real_Time_Possition = (Media_Possition*100)/Media_Lenth
GameControls.SetValue(Slider_Progress_Bar,Real_Time_Possition)
EndWhileSorry for my bad English
All Replies
-
Tuesday, January 24, 2012 2:26 PM
How about this ?
GameWindow.Width = 500
GameWindow.Height = 400
GameWindow.CanResize = "False"
GameWindow.Show()
sound_List()
Slider_Progress_Bar = GameControls.AddProgressBar(0,70,200,330,22)
Slider = GameControls.AddSlider(0,70,200,330,25)
GameControls.RegisterValueChangedEvent(Slider,"Possition_Change")
Play = GameControls.AddButton("Play",250-35,250-25,70,50)
GameControls.RegisterMouseDownEvent(Play,"Play_Song")
Next = GameControls.AddButton("Next",295,250-17.5,80,35)
GameControls.RegisterMouseDownEvent(Next, "Next_Song")
Prev = GameControls.AddButton("Prev",125,250-17.5,80,35)
GameControls.RegisterMouseDownEvent(Prev, "Prev_Song")
Stop = GameControls.AddButton("Stop",50,250-17,70,35)
GameControls.RegisterMouseDownEvent(Stop,"Stop_Song")
start= Lst[2]
MName= GameControls.AddButton(start,50,280,300,30)
Player = Media.CreateMediaPlayer(start,0,0,0,0)
Media.play(player)
While(Media_Possition<>Media_Lenth)
Media_Lenth = Media.GetLength(Player)
Media_Possition = Media.GetPosition(Player)
Real_Time_Possition = (Media_Possition*100)/Media_Lenth
GameControls.SetValue(Slider_Progress_Bar,Real_Time_Possition)
EndWhile
Sub Play_Song
Media.stop(Player)
b= Math.GetRandomNumber(num)
Media.SetMedia(Player, LST[b])
GameControls.SetText(Mname,LST[b])
Media.Play(Player)
EndSub
Sub Next_Song
Media.stop(Player)
b=b+1
If b>num Then
b=num
EndIf
Media.SetMedia(Player, LST[b])
GameControls.SetText(Mname,LST[b])
Media.Play(Player)
EndSubSub Prev_Song
Media.stop(Player)
b=b-1
If b<1 Then
b=1
EndIf
Media.SetMedia(Player, LST[b])
GameControls.SetText(Mname,LST[b])
Media.Play(Player)
EndSubSub Stop_Song
Media.stop(Player)
EndSub
Sub Possition_Change
Media_Lenth = Media.GetLength(Player)
Media_Possition = Media.GetPosition(Player)
Real_Time_Possition = (Media_Possition*100)/Media_Lenth
Media.SetPosition(Player,(GameControls.GetValue(Slider)*Media_Lenth)/100)
EndSub
Sub sound_List
LST=file.GetFiles("d:/MP3WAV") ' Your sound folder ( mp3 wav etc.... )
num=array.GetItemCount(LST)
EndSub- Marked As Answer by 4mir '- Tuesday, January 24, 2012 6:01 PM
-
Tuesday, January 24, 2012 6:01 PM
GameWindow.Width = 500
GameWindow.Height = 400
GameWindow.Title = "Small Music Player - By Amir"
GameWindow.CanResize = "False"
GameWindow.Show()
Slider_Progress_Bar = GameControls.AddProgressBar(0,70,200,330,15)
Slider = GameControls.AddSlider(0,70,200,330,5)
Play = GameControls.AddButton("Play",238,250-25,70,50)
Next = GameControls.AddButton("Next",317,250-17.5,80,35)
File_Open = GameControls.AddButton("Open Files",10,10,80,30)
Prev = GameControls.AddButton("Prev",149,250-17.5,80,35)
Player = Media.CreateMediaPlayer("C:\Users\Home\Music\Music\1.mp3",0,0,0,0)
Stop = GameControls.AddButton("Stop",70,250-17,70,35)
GameControls.RegisterValueChangedEvent(Slider,"Position_Change")
GameControls.RegisterMouseDownEvent(Play,"Play_Song")
GameControls.RegisterMouseDownEvent(File_Open,"Open_Files")
GameControls.RegisterMouseDownEvent(Next,"Play_Next")
GameControls.RegisterMouseDownEvent(Prev,"Play_Prev")
GameControls.RegisterMouseDownEvent(Stop,"Stop_Song")
Sub Open_Files
Dir = Dialogs.AskForDirectory()
Files_Array = FilePlus.GetAllFiles(Dir)
Total_Files = Array.GetItemCount(Files_Array)
If Array.IsArray(Files_Array) = "True" Then
GameControls.Remove(File_Open)
EndIf
For i = 1 To Total_Files
TextWindowPlus.WriteLine(Files_Array[i])
EndFor
EndSub
Sub Play_Song
If Array.IsArray(Files_Array) = "False" Then
Dialogs.ShowMessageBox("Please Select Media Diractory First","No Files","OK","Error")
Else
Media.stop(Player)
Media.SetMedia(Player, Files_Array[1])
File_Name = FilePlus.GetFileName(Files_Array[1])
GameWindow.BrushColor = GameWindow.BackgroundColor
GameControls.AddRectangle(15,100,455,25)
GameWindow.BrushColor = "Red"
GameControls.AddText("Now Playing : " +File_Name,20,100,"Comic Sans MS",15,"False","False")
Media.Play(Player)
EndIf
EndSub
Sub Play_Next
If Array.IsArray(Files_Array) = "False" Then
Dialogs.ShowMessageBox("No Song Files To Play","No Files","OK","Error")
Else
Media.stop(Player)
Song_Id = Song_Id + 1
If Song_Id > Total_Files Then
Song_Id = Total_Files
EndIf
Media.SetMedia(Player, Files_Array[Song_Id+1])
File_Name = FilePlus.GetFileName(Files_Array[Song_Id+1])
GameWindow.BrushColor = GameWindow.BackgroundColor
GameControls.AddRectangle(15,100,455,25)
GameWindow.BrushColor = "Red"
GameControls.AddText("Now Playing : " +File_Name,20,100,"Comic Sans MS",15,"False","False")
Media.Play(Player)
EndIf
EndSub
Sub Play_Prev
If Array.IsArray(Files_Array) = "False" Then
Dialogs.ShowMessageBox("No Song Files To Play","No Files","OK","Error")
Else
Media.stop(Player)
Song_Id = Song_Id - 1
If Song_Id < 1 Then
Song_Id = 1
EndIf
Media.SetMedia(Player, Files_Array[Song_Id])
File_Name = FilePlus.GetFileName(Files_Array[Song_Id])
GameWindow.BrushColor = GameWindow.BackgroundColor
GameControls.AddRectangle(15,100,455,25)
GameWindow.BrushColor = "Red"
GameControls.AddText("Now Playing : " +File_Name,20,100,"Comic Sans MS",15,"False","False")
Media.Play(Player)
EndIf
EndSub
Sub Stop_Song
If Array.IsArray(Files_Array) = "False" Then
Dialogs.ShowMessageBox("Already Stoped","No Files","OK","Error")
Else
Media.stop(Player)
EndIf
EndSub
Sub Position_Change
If Array.IsArray(Files_Array) = "False" Then
Dialogs.ShowMessageBox("Please Select Media Diractory First","No Files","OK","Error")
Else
Media_Lenth = Media.GetLength(Player)
Media_Position = Media.GetPosition(Player)
Real_Time_Position = (Media_Position*100)/Media_Lenth
Media.SetPosition(Player,(GameControls.GetValue(Slider)*Media_Lenth)/100)
EndIf
EndSub
While("True")
Media_Lenth = Media.GetLength(Player)
Media_Position = Media.GetPosition(Player)
Real_Time_Position = (Media_Position*100)/Media_Lenth
GameControls.SetValue(Slider_Progress_Bar,Real_Time_Position)
If Media_Position = Media_Lenth Then
Program.Delay(200)
GameControls.SetValue(Slider,0)
Play_Next()
EndIf
EndWhileThank you so much for help NaochanON :)
-
Thursday, January 26, 2012 6:40 PM
New Version: CGX280
need help on converting milliseconds into minutes and second like 01:45.
| Min = Math.Remainder(Media_Position/(1000*60),60)
| Secs = Math.Remainder(Media_Position/1000,60)did it myself:)
but
i still struggling on Slider issue got little success but when mouse is moves over slider it pause the playing sound.
- Edited by 4mir '- Thursday, January 26, 2012 7:11 PM made some change
-
Thursday, January 26, 2012 7:45 PM
Update : FXJ606
-
Saturday, January 28, 2012 7:00 PM
Hello,
I have a problem here :
Have an idea ?
absolu -
Sunday, January 29, 2012 3:30 AM
I also had a problem. This program needs dialogs.askdirectory or you must set your music directory first .
How about this . GSV585-0 ( use dialogs.askdirectory )
- Edited by NaochanON Sunday, January 29, 2012 4:18 AM renewed
-
Sunday, January 29, 2012 7:46 PM
New GUI LayoutThankyou so much NaochanON your code is simple clean and much faster than mine...
-
Sunday, January 29, 2012 7:51 PM
Hello,
I have a problem here :
Have an idea ?
absolu
care to explain please? -
Sunday, January 29, 2012 8:28 PM
I have an error with this instruction (problem of property) :
GameWindow.BrushColor
???
Sub Play_List
GameWindow.BrushColor = GameWindow.BackgroundColor
GameControls.AddRectangle(0,70,480,105)
GameWindow.BrushColor = "Red"
GameControls.AddText("Prev Song : " +Files_Array[Song_Id-2],20,70,"Comic Sans MS",11,"False","False")
GameControls.AddText("Prev Song : " +Files_Array[Song_Id-1],30,90,"Comic Sans MS",13,"False","False")
GameWindow.BrushColor = "Blue"
GameControls.AddText("Current Song : " +Files_Array[Song_Id],40,110,"Comic Sans MS",16,"True","False")
GameWindow.BrushColor = "Red"
GameControls.AddText("Next Song : " +Files_Array[Song_Id+1],30,130,"Comic Sans MS",13,"False","False")
GameControls.AddText("Next Song : " +Files_Array[Song_Id+2],20,150,"Comic Sans MS",11,"False","False")
EndSub
Sub Time_Info
GameWindow.BrushColor = "White"
GameControls.AddRectangle(417,199,60,19)
GameWindow.BrushColor = "Black"
absolu -
Monday, January 30, 2012 4:13 AM
SB's color is set and it returns the color code correctly. but data doesn't. Try this.
GraphicsWindow.Show()
GraphicsWindow.BackgroundColor="Teal"
GraphicsWindow.BrushColor="Red"
TextWindow.WriteLine("BackGroundColor= "+GraphicsWindow.BackgroundColor)
TextWindow.WriteLine("BrushColor= "+GraphicsWindow.BrushColor)
TextWindow.WriteLine(" ")gameWindow.Show()
gameWindow.BackgroundColor="Teal"
gameWindow.BrushColor="Red"
TextWindowplus.WriteLine("BackGroundColor= "+gamewindow.BackgroundColor)
TextWindowPlus.WriteLine("BrushColor= "+gameWindow.BrushColor) -
Monday, January 30, 2012 6:41 AM
No, there is the same problem.
absolu -
Monday, January 30, 2012 8:37 AM
Hidden playlist pan
Import Code : BGV706
NaochanON Please help me to show file list into playlist pan i mean just give me idea... :) -
Monday, January 30, 2012 8:51 AMThis time it's better, it works, but there is still a problem with the dialog box to open an mp3 or a video.
The dialog box asks me to select a folder, but when I select the folder where I have my music mp ", etc ... the folder appears empty ... and suddenly, I can not open ...
absolu -
Monday, January 30, 2012 2:06 PM
BGV706-1 Play list disappears
BGV706-2 Play list moves left(right) like this.
- Edited by NaochanON Monday, January 30, 2012 2:50 PM
-
Monday, January 30, 2012 2:24 PM
1) check your file extension type , and change line22.
Line 22... Musicext="mp3:wma:mp4:avi:wmv:mpg" ' add your file type extension like this
2)change starting file No at line 53 ,76 ( maybe array[1] is not a music(movie) file. my case was .ini file )
Line 53... Player = Media.CreateMediaPlayer(Files_Array[3],7,7,446,296) ' Open first file
Line 76... Song_Id=3
-
Monday, January 30, 2012 4:53 PM
I tried, but it makes no difference.
Here is a program that I tried and that works. it will give you an idea, perhaps, the problem I encounter.FWN604
I have all the extensions.
absolu -
Monday, January 30, 2012 5:50 PM
Hello NaoChanON i want something like this...
GameWindow.Show() For i = 1 To 5 songname[i] = GameControls.AddText("Song" +i,5,40*i,"Arial",16,"False","False") EndFor For i = 1 To 5 GameControls.RegisterMouseDownEvent(songname[i],"click"+i) EndFor Sub click1 Dialogs.ShowMessageBox("Song 1","Yeah","OK","None") EndSub Sub click2 Dialogs.ShowMessageBox("Song 2","Yeah","OK","None") EndSub Sub click3 Dialogs.ShowMessageBox("Song 3","Yeah","OK","None") EndSub Sub click4 Dialogs.ShowMessageBox("Song 4","Yeah","OK","None") EndSub Sub click5 Dialogs.ShowMessageBox("Song 5","Yeah","OK","None") EndSub
- Edited by 4mir '- Monday, January 30, 2012 6:02 PM
-
Monday, January 30, 2012 5:57 PM
draw a sine wave to make a fake sound visualizer when an audio sound is playing??? WOW It's a great idea :)I tried, but it makes no difference.
Here is a program that I tried and that works. it will give you an idea, perhaps, the problem I encounter.FWN604
I have all the extensions.
absolu -
Monday, January 30, 2012 6:59 PM
What about this? NaoChanON -
Tuesday, January 31, 2012 12:02 AMLooks very nice!
-
Tuesday, January 31, 2012 5:01 PM
Import code : KTK217
Is there any way to get rid of this nasty flickering while drawing or cleaning something on Graphic window???
NaochanON if you have spare time please help me to make file filter it loads everything from directory i want to filter non video and music file... -
Tuesday, January 31, 2012 10:09 PM
There is something i don't understand. I run the program and i have this message :
Ok, but, when I selection a file (échantillon de musique) for open my musics mp3, there is this message:
So, I can not open and test a music or video.
What should I do ?
absolu -
Tuesday, January 31, 2012 10:10 PM
When I run the program, a window opens automatically.
I select a folder (sample music ===> where a few mp3)
But it does not work.So, I can not open and test a music or video.
What should I do?
absolu -
Tuesday, January 31, 2012 11:48 PM
Error message is not shown. PLS add image(jpg or png file).
maybe array[n] is not a music(movie) file. my case was desktop.ini file
*Desktop.ini file is a hidden file. but file.getfiles command gets it.
see below window , List:4 desktop means "Desktop,ini" file.- Edited by NaochanON Wednesday, February 01, 2012 3:33 AM add comment
-
Wednesday, February 01, 2012 3:00 AM
TKQ922 add text once. Use settext to change name and
for i=.... settext endfor. to simplify.
PLease use TKQ922-0
Notice: Subfolder sound files or movie files are gotten and listed.
This is avoided if you change fileplus.getallfiles to fileplus.getfiles.
TKQ922-3 (Added program end button and New file open button)
- Edited by NaochanON Wednesday, February 01, 2012 1:56 PM comment added
-
Wednesday, February 01, 2012 1:54 PMYes, this time it's good. It works.
I created the folder on the desktop, with my files.
With the program TKQ922-0 I do not read the audio, but video, while with the videos TKQ922 walk.
There is just the scroll bar does not vary with the length of the files.
And it would be nice to open files in any folder.
I have a little ^ ^ but it's worth, I think.
If interested, I can look at a graphic of the player ^ ^? (with separate elements).
absolu -
Wednesday, February 01, 2012 2:02 PM
A bit modified to scroll Playlist automatically when next song event is triggered...
Code : ZHT069
And Thank you So Much NaochanON... your very kind person...
now this project is complete next task is to port this app to VB10 :)
Thanks again NaochanON for your help...
They say working hard is good but i say working smart is best... -
Wednesday, February 01, 2012 2:10 PM
Yes, this time it's good. It works.
can you please explain the bold part???
I created the folder on the desktop, with my files.
With the program TKQ922-0 I do not read the audio, but video, while with the videos TKQ922 walk.
There is just the scroll bar does not vary with the length of the files.
And it would be nice to open files in any folder.
I have a little ^ ^ but it's worth, I think.
If interested, I can look at a graphic of the player ^ ^? (with separate elements).
They say working hard is good but i say working smart is best... -
Wednesday, February 01, 2012 2:16 PMI think it is possible to improve the appearance of the player. So I propose, if interested, to prepare a visual interface prettier, with photoshop, etc ...
We can do everything separately (buttons, playback bar, etc ...)
absolu -
Wednesday, February 01, 2012 2:17 PM
Not at all. I got nice ideas from your program. Thanks.
I can't help you about VB. (I don't know about VB at all)
ZHT069 works well. nice!
-
Wednesday, February 01, 2012 2:23 PM
Not at all. I got nice ideas from your program. Thanks.
Please share with me ;)
and what "Not at all"???
They say working hard is good but i say working smart is best... -
Wednesday, February 01, 2012 2:27 PM
I think it is possible to improve the appearance of the player. So I propose, if interested, to prepare a visual interface prettier, with photoshop, etc ...
i tried few days ago will show you a screenshot but that isn't complete as of now
We can do everything separately (buttons, playback bar, etc ...)
absolu
They say working hard is good but i say working smart is best... -
Wednesday, February 01, 2012 2:31 PMok.
Do not hesitate, if you need help with this graphic
absolu -
Wednesday, February 01, 2012 4:46 PM
in program TKQ922-3 we need to clean already loaded files from file array but don't know how...TKQ922 add text once. Use settext to change name and
for i=.... settext endfor. to simplify.
PLease use TKQ922-0
Notice: Subfolder sound files or movie files are gotten and listed.
This is avoided if you change fileplus.getallfiles to fileplus.getfiles.
TKQ922-3 (Added program end button and New file open button)
They say working hard is good but i say working smart is best... -
Wednesday, February 01, 2012 4:52 PM
ok.
Do not hesitate, if you need help with this graphic
absolu
i know nothing about Photoshop and graphics. your help would be more than appreciated... :)
They say working hard is good but i say working smart is best... -
Wednesday, February 01, 2012 5:22 PM
i know nothing about Photoshop and graphics. your help would be more than appreciated... :)
They say working hard is good but i say working smart is best...
ok, I'll make you an offer graphic and if you're going to advance it like that ^ ^
I prepare a proposal tonight.
absolu -
Wednesday, February 01, 2012 5:28 PM
in program TKQ922-3 we need to clean already loaded files from file array but don't know how...TKQ922 add text once. Use settext to change name and
for i=.... settext endfor. to simplify.
PLease use TKQ922-0
Notice: Subfolder sound files or movie files are gotten and listed.
This is avoided if you change fileplus.getallfiles to fileplus.getfiles.
TKQ922-3 (Added program end button and New file open button)
They say working hard is good but i say working smart is best...
Indeed, it is better with these little options.
the playhead does not move in the duration of the file.
absolu -
Wednesday, February 01, 2012 9:43 PM
Here is a first proposal for the player interface :
We can try to work around that style, adjusting certain dimensions.
And why not add this in the small basic library.
absolu- Edited by absolu Wednesday, February 01, 2012 9:45 PM
-
Thursday, February 02, 2012 11:53 AM
looking great...
Today i looked into vlc Player skin and i strongly believe that it wont be so hard to load vlc skins into our player with little and no modification? what do you think absolu??
and yes your interface looks very cool now design is very clean and simple.
They say working hard is good but i say working smart is best... -
Thursday, February 02, 2012 12:00 PMDCH701
man it gonna be a great piece of software i'm excited.
They say working hard is good but i say working smart is best... -
Thursday, February 02, 2012 1:30 PM
Thank you ^ ^looking great...
Today i looked into vlc Player skin and i strongly believe that it wont be so hard to load vlc skins into our player with little and no modification? what do you think absolu??
and yes your interface looks very cool now design is very clean and simple.
They say working hard is good but i say working smart is best...
If you want, I can prepare the separate elements in .PNG with alpha, in order to manipulate and easy positioning.
Then we can adjust them.
absolu -
Thursday, February 02, 2012 1:35 PMLets's go !! ^^
absolu -
Thursday, February 02, 2012 4:41 PM
Okay Lets go...
They say working hard is good but i say working smart is best... -
Thursday, February 02, 2012 4:44 PM
hmm email me when you finish your work...
amir_rt@live.com
They say working hard is good but i say working smart is best... -
Thursday, February 02, 2012 4:45 PMHere I am at work, but I'm starting tonight, to the separate elements ^ ^
absolu -
Thursday, February 02, 2012 4:48 PM
Ok, no problem !!!hmm email me when you finish your work...
amir_rt@live.com
They say working hard is good but i say working smart is best...
absolu -
Thursday, February 02, 2012 5:25 PM
Ok, no problem !!!hmm email me when you finish your work...
amir_rt@live.com
They say working hard is good but i say working smart is best...
absolu
I have send you a mail, with le first test ^^
absolu -
Friday, February 03, 2012 8:00 AM
TKQ922-5 slider works.
-
Friday, February 03, 2012 6:26 PMGreat, it will be top (-;
I will make adjustments dimensions.
I send you an email in the weekend.
absolu -
Saturday, February 04, 2012 6:18 AM
Great, it will be top (-;
hmmm ok
I will make adjustments dimensions.
I send you an email in the weekend.
absolu
They say working hard is good but i say working smart is best... -
Sunday, February 05, 2012 5:57 PMI made some adjustments on the interface and the parameters for the positions of the buttons.
Here is a screenshot.
Here is the code, with the repositioning elements :QTD813
absolu -
Saturday, February 25, 2012 4:56 PM
Very interesting project going on here. Unfortunately your players wont work with next version of Data Extension (Changed CreateMediaPlayer to AddMediaPlayer and removed File parameter )
You will have nice Media player sample in few days after I have finished testing new features of my extension.
-
Saturday, February 25, 2012 6:39 PMGreat,wecan not wait^ ^
absolu
-
Wednesday, March 28, 2012 7:02 PM
Very interesting project going on here. Unfortunately your players wont work with next version of Data Extension (Changed CreateMediaPlayer to AddMediaPlayer and removed File parameter )
You will have nice Media player sample in few days after I have finished testing new features of my extension.
Thanks Oskariok :) i am waiting for next version of data ext....They say working hard is good but i say working smart is best...

