SoundWave
SoundWave copied to clipboard
Modification in the current code
Hello , Thanks for your library. I want to use this as a progress bar and successfully integrate, now the issue is that when progress will fill with gradiant, i dont want that, so is that possible to remove this without making any change in the pod file?
Please find attachment, how i used as a progress bar.
Thank you.
Hello @Parthhyperlink and thank you for your message!
Good job on integrating it as a progress bar, as I can see in your screenshot 👌 It could be a good evolution of the library actually, having only the top part of it (instead of a "mirrored" two sided graph).
You should be able to not have any gradient by setting both gradientStartColor
and gradientEndColor
to the same color 👍 This wouldn't require any change on the Pod.
self.audioVisualizationView.gradientStartColor = UIColor.red
self.audioVisualizationView.gradientEndColor = UIColor.red
Let me know how it goes!
Hello, Thanks for your quick response. No, i can't set a start and end color both a red color, becuase when progress wasn't start at that moment i need to set a Grey color and after animation start it will be fill up with red color. but do not need a red color with gradient. also i used this view in the Uitableview cell, so once progress animation is start and i scroll a table view and cell is not visible than progress is stop and once i scroll down and cell is visible it starts again, but i want it continuously start even though cell is not visible. please help me in this because of this right now i am stuck here.
If you have any another suggestion or library for this type of Audio progress please suggest me.
Thank you.
Hello, Is there any update regarding my Question, please help me , i am stuck here
Hello @Parthhyperlink, my apologies for the delay!
Color Challenge
So if I understand well:
- You need to have a plain grey color when the progress isn't started
- You need to have a plain red color when the progress is started
This should be achievable if you change the colors every time you start or pause/stop playing:
self.audioVisualizationView.audioVisualizationMode = .read
self.audioVisualizationView.meteringLevels = [0.1, 0.67, 0.13, 0.78, 0.31]
// Start playing
self.audioVisualizationView.play(for: 5.0)
self.audioVisualizationView.gradientStartColor = UIColor.red
self.audioVisualizationView.gradientEndColor = UIColor.red
// Stop playing
self.audioVisualizationView.stop()
self.audioVisualizationView.gradientStartColor = UIColor.gray
self.audioVisualizationView.gradientEndColor = UIColor.gray
Animation Stops Issue
That sounds like a UI issue, I am not sure what is happening exactly here and I would need to debug. I can try to give it a try in the coming days. My guess is that the view may stop drawing
when the Table View scrolls?
I don't know of any other library that does exactly the same thing on the top of my head, but I would assume there are other ones you could use that would do what you need, which seems to be a pretty common use case. Keep me posted!
Hello Thanks for your response.
Is it possible to start an animation from any specific time?
For example : There is a 100 bars and animation time is 3 minutes, so i need to start animation from 50 number bar and time is 1 minute and 45 sec? is that possible?
Thank you.
Hello @Parthhyperlink,
This is not possible at the moment. For now, we can do the following:
self.audioVisualizationView.play(for: 5.0)
self.audioVisualizationView.pause()
self.audioVisualizationView.play(for: duration - 5.0)
self.audioVisualizationView.stop()
But we have to start from the beginning of the sample. We could consider adding a function that looks like this however:
let totalDuration: TimeInterval = 3.0 * 60.0 // 3 minutes
self.audioVisualizationView.play(from: 60.0 + 45.0, for totalDuration) // start at 1mn 45s
Would that makes sense?
This would be a great functionality to have.
@bastienFalcou do you intent to add this functionality?