custom URLProtocol cannot work with AVPlayer

270 Views Asked by At

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.

1

There are 1 best solutions below

1
Jimmy On

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