2

goal: network flow collection in my app.

For collecting all network flow, i custom URLProtocol. it all work fine with normal GET, or POST request of Json. But it makes audio playing part not working. My Audio playing part is based on AVPlayer and AVPlayerItem. If i unregister custom protocol, audio playing works again. Does it has some connections between two of them ?

According to https://forums.developer.apple.com/thread/75328 AVPlayer does go through the URL loading system, but those requests are made in a helper process (mediaserverd) and thus don’t ‘see’ custom NSURLProtocol subclass.

Here post my implementation of custom protocol.https://github.com/JimmyOu/JODevelop/blob/master/JODevelop/Tool/performance_Monitor/Network/NEHTTPMonitor.m

Thanks all.

Jimmy
  • 55
  • 4

1 Answers1

0

there is no way to deal with it .you cant custom protocol to deal with AVPlayer staff.My compromise is filtering .mp4 or .mp3 url sacrificing some lost network flow.but it wont make mistake

Jimmy
  • 55
  • 4
  • I encountered the same problem, but found the custom NSURLProtocol works in Xcode iOS simulator with AVPlayer, only failed in real devices (see https://stackoverflow.com/questions/60128491/nsurlprotocol-registerclass-works-for-ios-simulator-but-not-actual-device) – user1783732 Feb 11 '20 at 23:52