16

Is there a way to have the audio metering levels from the AVPlayer class?

I know that AVAudioPlayer does that, but it doesn't play streamed http .m3u8 urls , like AVPlayer does.

neowinston
  • 7,584
  • 10
  • 52
  • 83
  • Did you have any success? – Bhumit Mehta Jun 09 '14 at 12:57
  • Check this: https://github.com/akhilcb/ACBAVPlayerExtension – adev Aug 11 '17 at 18:42
  • Looks great! I'll check it out. – neowinston Aug 11 '17 at 18:50
  • Has anybody found the solution to it. @adev : I tried using above ACBAVPlayerExtension but its throwing error "ACBAVPlayerExtension[329:43663] failed to setup processor". – SJ3040 Jul 12 '19 at 06:57
  • @SJ3040, It used to work fine for me. I am not sure what changed. It wont work for streaming audio since Apple restricts it. I am not sure if you were using for that. – adev Jul 12 '19 at 18:50
  • @adev Oh, I wanted to use it for streaming audio (to play an url with .m4a) :( So there is no way to make it for streaming audio? Except for stream the audio manually – surfrider Aug 04 '21 at 08:36

3 Answers3

1

I do not know, specifically, if they privatized what you're looking for, but I do know the various high-level classes are usually just the tops of the pyramid for the lower level AV items. In any case, I do have good news...

Remember an AVPlayer uses an AVPlayerItem. The AVPlayerItem has assets (and an AVAudioMix). The AVAssets have the properties for modifying audio and video.

Unfortunately, the properties indicate they are "suggestions", not absolutes, but try this:

preferredVolume

If you reference the docs, AVPlayer->AVPlayerItem->AVAsset and voila. It might be what you're after.

Hope it's enough

Stephen J
  • 2,367
  • 2
  • 25
  • 31
0

There is a fork of audioStream link ,does what you want.

I had try avplayer for days ,but the end shows it can't. Likely i find the audioStream fork version.This code is 4 years old ,but still works good at ios7(change the demo target from ios3 to ios7).

rotoava
  • 625
  • 8
  • 18
  • I've been to that example before, but it doesn't handle .m3u8 stream format as I need. Thanks for your answer though. – neowinston Mar 07 '14 at 16:02
-1

I've recently found this GitHub project called SCWaveformView that helped me a lot, and I hope someone else out there could benefit from it as well.

Edit: Actually the extension suggested by dev in the comments is quite nice, and you can find it here, the ACBAVPlayerExtension.

neowinston
  • 7,584
  • 10
  • 52
  • 83