dmrschmidt/DSWaveformImage

I need to show loader till complete image generating from audio URL.

SantoshProdev opened this issue · 2 comments

        let asset = AVURLAsset(url: url)
        let width = (SCREENWIDTH() * CGFloat(Double(CMTimeGetSeconds(asset.duration))))/self.vdoDur
        let x = (SCREENWIDTH() - 170)/2
        self.waveformImageView = WaveformImageView(frame: CGRect(x: x, y: 15, width: width, height: 20))
        self.waveformImageView.configuration = Waveform.Configuration(
            backgroundColor: .clear,
            style: .striped(.init(color: UIColor(red: 209/255.0, green: 209/255.0, blue: 209/255.0, alpha: 1), width: 5, spacing: 5)),
            verticalScalingFactor: 0.5
        )
        self.waveformImageView.waveformAudioURL = url

how can i know image is loaded via audio URL.
Can you help me find solution of this?

Hey @software124. For UIKit, this is not currently supported by WaveformImageView. It is supported in SwiftUI's WaveformView (see last example there in the linked README).

Using SwiftUI would be my recommended approach.

If you cannot use SwiftUI, the best alternative is using standard UIImageViews in conjunction with WaveformImageDrawer

Thank you @dmrschmidt.