Improve audio waveform scrolling performance (#1292)

The object is already cached & the waveform view constructed when scrolling,
so there's no need to re-create the view.

This doesn't fix the problem with the wave-form generation on the first
view of the message.  That is a more critical problem in the underlying
SCWaveformView class which renders on the main thread instead of doing
it asynchronously.

FIXES #1258
pull/1/head
Vitali Lovich 9 years ago committed by Michael Kirk
parent 92b3ea5d25
commit 547cd9797a

@ -143,14 +143,16 @@
NSURL *url =
[MIMETypeUtil simLinkCorrectExtensionOfFile:_attachment.mediaURL ofMIMEType:_attachment.contentType];
AVURLAsset *asset = [[AVURLAsset alloc] initWithURL:url options:nil];
_waveform = [[SCWaveformView alloc] init];
_waveform.frame = CGRectMake(42.0, 0.0, size.width - 84, size.height);
_waveform.asset = asset;
_waveform.progressColor = [UIColor whiteColor];
_waveform.backgroundColor = [UIColor colorWithRed:229 / 255.0f green:228 / 255.0f blue:234 / 255.0f alpha:1.0f];
[_waveform generateWaveforms];
_waveform.progress = 0.0;
if (!self.waveform) {
AVURLAsset *asset = [[AVURLAsset alloc] initWithURL:url options:nil];
self.waveform = [[SCWaveformView alloc] init];
self.waveform.frame = CGRectMake(42.0, 0.0, size.width - 84, size.height);
self.waveform.asset = asset;
self.waveform.progressColor = [UIColor whiteColor];
self.waveform.backgroundColor = [UIColor colorWithRed:229 / 255.0f green:228 / 255.0f blue:234 / 255.0f alpha:1.0f];
[self.waveform generateWaveforms];
self.waveform.progress = 0.0;
}
_audioBubble = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, size.width, size.height)];
_audioBubble.backgroundColor =

Loading…
Cancel
Save