Search code examples
iosavplayerinstrumentshttp-live-streaming

Monitoring network data usage of AVPlayer using Instruments


I just noticed that it seems impossible to monitor the network usage of AVPlayer using Instruments.

Using Instruments 9.4.1. iOS 11.4ish.

Using a HLS stream, indefinitelyish streaming a video. But no action going on in Instruments.

Question: How can Instruments be missing this? Is there another way of monitoring network data coming from/to my app?

Note: even the "Network Activity Report" in Xcode 9.4.1 shows no trace of network data coming from the video stream.


Solution

  • I had a thought, and although it's just an assumption it might be the correct answer in the end.

    When using AVPlayer the actual network transfer is likely taken care of by the operating system and so the network transfer is not tied to your app process per se. Kind of.

    So what I'm doing right now is using rvictl to create an interface to my connected iPhone, then use WireShark to monitor that interface. As explained in this answer: https://stackoverflow.com/a/14066183/129202

    While in WireShark I choose the interface I created above, then menu: Statistics > I/O Graph. I can successfully see even HLS transfer pop up in the diagram there! 🏆 So this will of course monitor any other data transferred from/to the iPhone, but for my case it's enough to see the intervals of HLS downloads.