SCWaveformView 2.0.6

SCWaveformView 2.0.6

测试已测试
Lang语言 Obj-CObjective C
许可证 Apache 2
发布最近发布2015年3月

Simon Corsin维护。



  • 作者
  • Simon CORSIN

一个性能极高的可定制波形视图。提取资产(可以是视频或音频)的音频部分,并显示波形。

SCWaveformView 优化为了尽可能少地读取文件。当滚动或显示波形的另一部分时,它只会读取渲染新部分所需的内容。它将文件数据缓存起来,以避免读取已计算的部分。此外,如果确实需要读取文件,它将通过较大的段读取以最大限度地减少下次时间范围更改时的读取操作数量。

主要功能

  • 可以显示播放进度。
  • 颜色可随时更改而无需重新处理资产。
  • 如果只显示屏幕上的音频部分,不需要读取整个文件。
  • 具有可滚动的波形视图。
  • 可以设置一个精度以加快某些设备的绘图速度
  • 线条宽度可更改,因此您可以拥有独特的波形设计
  • 设置资产后,您就可以开始了。
  • ARC。

此项目灵感来源于 https://github.com/fulldecent/FDWaveformView

Podfile

示例

 // Allocating the waveformview
 SCWaveformView *waveformView = [[SCWaveformView alloc] init];

 // Setting the asset
 AVAsset *asset = [AVURLAsset URLAssetWithURL:[NSURL URLWithString:@"blabla.mp3"]];
 waveformView.asset = asset;

 // Setting the waveform colors
 waveformView.normalColor = [UIColor greenColor];
 waveformView.progressColor = [UIColor redColor];

 // Set the play progress
 waveformView.progressTime = CMTimeMakeWithSeconds(5, 10000);

 // Show only the first second of your asset
 waveformView.timeRange = CMTimeRangeMake(kCMTimeZero, CMTimeMakeWithSeconds(1, 1));

 // Use it inside a scrollView
 SCScrollableWaveformView *scrollableWaveformView = [SCScrollableWaveformView new];
 scrollableWaveformView.waveformView; // Access the waveformView from there

 // Set the precision, 1 being the maximum
 waveformView.precision = 0.25; // We are going to render one line per four pixels

 // Set the lineWidth so we have some space between the lines
 waveformView.lineWidthRatio = 0.5;