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

Cannot get SCWaveformView to Render #27

Open
nlabhart opened this issue Sep 21, 2016 · 2 comments
Open

Cannot get SCWaveformView to Render #27

nlabhart opened this issue Sep 21, 2016 · 2 comments

Comments

@nlabhart
Copy link

First off, Love this component - kudos. Can't wait to get it working!

I am building an SCWaveformView through code, and using autolayout (SnapKit, to be exact). Here is the code for doing so:

waveformView = SCWaveformView(frame: CGRectZero)
waveformView.precision = 0.25
waveformView.lineWidthRatio = 0.5
waveformView.normalColor = UIColor.lightGrayColor()
waveformView.progressColor = UIColor.mbTurquoiseColor()
waveformView.progressTime = kCMTimeZero
mainPlayerPanel.addSubview(waveformView)

waveformView.snp_makeConstraints { (make) in
     make.width.equalTo(UIScreen.mainScreen().bounds.width * 0.7)
     make.top.equalTo(artistNameFull.snp_bottom).offset(45)
     make.centerX.equalTo(mainPlayerPanel)
     make.height.equalTo(75)
}

However. I'm not adding the asset until viewDidLayoutSubviews is being called. Here is the code for that.

let asset = AVAsset(URL: NSURL(string: NSBundle.mainBundle().pathForResource("credits", ofType: "mp3")!)!)
waveformView.asset = asset
let timeRang = CMTimeRangeMake(kCMTimeZero, waveformView.actualAssetDuration)
waveformView.timeRange = timeRang

Once this is done, I would expect my waveform view to show up/be drawn. However, its not. Am I doing something incorrect that I'm not seeing?

Thanks!

@Arpit723
Copy link

Arpit723 commented Dec 4, 2017

I have imported SCWveForm to my project. But I can not see WaveForm graphics.? Do you find any solution ?
Thanks

@Arpit723
Copy link

Arpit723 commented Dec 6, 2017

I just updated lineWidthRatio to 1, and it works like charm.

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

2 participants