Skip to content

Cannot get SCWaveformView to Render #27

@nlabhart

Description

@nlabhart

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions