Why AVPlayer play HLS, maintain two connections?

When I play a url:(http://c4icyelb.prod.playlists.ihrhls.com/2245_icy?at=1&fb_broadcast=false&deviceid=amzn1.account.AEAEUTCMFLSHWEY3VKZFQNDFKPXQ&callLetters=KHKS-FM&streamid=2245&clienttype=amazon&iheartradioversion=1.0&osversion=1.0&devicename=Indigo&terminalid=304&init_id=8169&profileid=137824891),

The backend colleague tell me that The APP client will maintain two connections.

2019/2/1 22:482019/2/1 22:50132132405700140106.1 KISS FMKBKS-FM4257amzn1.account.af6qodz4srwemkain2duhhc6uliaindigoAppleCoreMedia/1.0.0.16C101 (iPhone; U; CPU OS 12_1_2 like Mac OS X; en_us)amazon
2019/2/1 22:482019/2/1 22:53323323405700140106.1 KISS FMKBKS-FM4257amzn1.account.af6qodz4srwemkain2duhhc6uliaindigoAppleCoreMedia/1.0.0.16C101 (iPhone; U; CPU OS 12_1_2 like Mac OS X; en_us)amazon

First column is when the connection to the stream starts, and the second column is when it ends.

So you can see the device is connecting to the same stream less than 1 second a part. First connection is lasting ~132 seconds. And second connection shows the actual listening time via the test.


It’s fine if the device needs to make an additional call to the stream url because of how the framework works, but it needs to end the connection within a second before or when the second connection to the same stream opens.


My code:


NSString *url = @"http://c4icyelb.prod.playlists.ihrhls.com/2245_icy?at=1&fb_broadcast=false&deviceid=amzn1.account.AEAEUTCMFLSHWEY3VKZFQNDFKPXQ&callLetters=KHKS-FM&streamid=2245&clienttype=amazon&iheartradioversion=1.0&osversion=1.0&devicename=Indigo&terminalid=304&init_id=8169&profileid=137824891";

AVAsset * liveAsset = [AVURLAsset URLAssetWithURL:[NSURL URLWithString:url] options:nil];

AVPlayerItem * playerItem = [AVPlayerItem playerItemWithAsset:liveAsset];

[self.musicPlayer insertItem:playerItem afterItem:nil];

[self.musicPlayer play];


Can somebody help to check it?


Thanks very much!