SRGSSR / srgletterbox-apple

The official SRG SSR media playback experience
https://srgssr.github.io/marketing/letterbox/
MIT License
14 stars 7 forks source link

Remove bit rate support #295

Closed defagos closed 1 year ago

defagos commented 1 year ago

Pull request

Description

This PR removes bit rate support since it does not work anymore.

Changes made

pyby commented 1 year ago

The code removed in the related library https://github.com/SRGSSR/srganalytics-apple/pull/68 modified the stream url to add __b__=800 query parameter, including to all other query parameters, a value encoding.

TL;DR ℹī¸ On SRF stage, no url modification by the player (vod-stage.srf.ch). On SRF prod, url is modified by the player (srf-vod-amd.akamaized.net) and the new url is not playable.

Without the startBitRate property, which was implemented for Akamai MSL3 packaging solution, the played url is not modified anymore, even if the hostname contains "akamai".

Here is why it played on SRF stage and not in SRF prod:👇

The code to add __b__ parameter:

NSUInteger startBitRate = preferredSettings.startBitRate;
if (startBitRate != 0 && [URL.host containsString:@"akamai"] && [URL.path.pathExtension isEqualToString:@"m3u8"]) {
  NSURLComponents *URLComponents = [NSURLComponents componentsWithURL:URL resolvingAgainstBaseURL:NO];
  NSMutableArray<NSURLQueryItem *> *queryItems = URLComponents.queryItems.mutableCopy ?: [NSMutableArray array];
  [queryItems addObject:[NSURLQueryItem queryItemWithName:@"__b__" value:@(startBitRate).stringValue]];

  URLComponents.queryItems = queryItems.copy;
  URL = URLComponents.URL;
}

It explains why nobody catched this issue on SRF stage environnement, and only in production environment.

With this PR, no more startBitRate property, which was implemented for Akamai MSL3 packaging solution. The played url is now not modified anymore, even if the hostname contains "akamai".