Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BLOCKED ON ISSUE 139 ## Are there any examples of the waveform progress updating as an audio file plays? #130

Open
sumitpaul opened this issue Sep 25, 2019 · 2 comments

Comments

@sumitpaul
Copy link

sumitpaul commented Sep 25, 2019

I looked at the "Examples" folder in the repo but it's not very clear how this would work with a playing audio. I am able to display the waveform and I can tap to change the highlighted part of the waveform, but I can't figure out how to connect this progress to the playing audio file. Please help.

@ibilalnawaz
Copy link

Any progress ?

@rthompson40
Copy link

rthompson40 commented Jul 8, 2020

Hi there,

I know this is probably no longer needed by either of you but perhaps this can help a future user:

  1. In viewDidLoad(), add your FDWaveformView as per your specification (in this example, I used interface builder and my IBOutlet is called waveView). Ensure scrolling is enabled for your waveform:

image

  1. I'm using a button to trigger playback in this example. Upon pressing the button when no file is playing, I call this function. The animation time parameter is set to equal the length of the audio file for fairly obvious reasons. (NOTE: without the .curveLinear option, the 'scroll' will be out-of-sync. This was unfortunately not apparent in the example project but thankfully I realised it was a non-linear response after some trial and error):

image

  1. Upon finishing the audio playback, I reset the 'progress' by triggering this method:

image

Hopefully this helps! I'm fairly new to software development so forgive me if there's any glaring 'no-no's.

EDIT:

I've found that stopping this animation in the middle can be glitchy at best. My code is now using UIViewPropertyAnimator which is working perfectly:

image

@fulldecent fulldecent changed the title Are there any examples of the waveform progress updating as an audio file plays? BLOCKED ON ISSUE 139 ## Are there any examples of the waveform progress updating as an audio file plays? Sep 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants