aws / aws/amazon-ivs-react-native-player
Player does not respect Redirection from HTTP response
- Dominant language
- TypeScript
- Stars
- 313
- Forks
- 42
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
The stream URL responds with a different 'Location' header, it ignores that and tries to stream data from the same domain but with a mangled path.
**To reproduce**
Steps to reproduce the behavior.
Utilize a endpoint that returns a Location header pointing to the stream file in a Storage service (e.g. gcp, AWS S3, etc)
**Expected behavior**
The player should load from the proper "new" location (e.g. be redirected) using the Location header data.
**Screenshots**
**The request:**

**The location header:**

**Expected behavior:**

**How it behaves:**

**Device (please complete the following information):**
- Simulator or Real Device: Simulator
- Device: iPhone 13
- OS: 15.5
**Debug logs**
(Errors bellow are due to the player trying to load the stream from a mangled path):
```
Error 500: (MediaPlaylist: ErrorNetwork)
[Error: Request failed with status code 503]
```
**Additional context**
The expected behaviour comes from a package that I used before called `react-native-aws-ivs-player` which reacted correctly to the http redirection.
HTTP Response data:
```JSON
{
"id": 415401149733227800,
"requestTime": "2022-08-11T01:30:37.419Z",
"method": "GET",
"url": "https://hml-mobile.tradersclub.com.br/tcmediaapi/v1/file/hls/6524ac42-fb1b-4c10-a96a-a2f088448913.m3u8",
"domain": "hml-mobile.tradersclub.com.br/tcmediaapi/v1/file/hls/6524ac42-fb1b-4c10-a96a-a2f088448913.m3u8",
"requestHeaders": [
{
"value": "application/x-mpegURL, application/vnd.apple.mpegurl, application/json, text/plain",
"key": "Accept"
}
],
"responseTime": "2022-08-11T01:30:37.589Z",
"status": 307,
"reason": "temporarily redirected",
"responseHeaders": [
{
"value": "h3=\":443\"; ma=86400, h3-29=\":443\"; ma=86400",
"key": "Alt-Svc"
},
{
"value": "cloudflare",
"key": "Server"
},
{
"value": "DYNAMIC",
"key": "cf-cache-status"
},
{
"value": "max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"",
"key": "expect-ct"
},
{
"value": "https://storage.googleapis.com/tc-media-storage-hml/hls/6524ac42-fb1b-4c10-a96a-a2f088448913/6524ac42-fb1b-4c10-a96a-a2f088448913.m3u8",
"key": "Location"
},
{
"value": "Thu, 11 Aug 2022 01:30:37 GMT",
"key": "Date"
},
{
"value": "max-age=31536000; includeSubDomains; preload",
"key": "Strict-Transport-Security"
},
{
"value": "b13ac13f-ad8c-4521-b5ff-54741cdc9c7d",
"key": "x-request-id"
},
{
"value": "0",
"key": "Content-Length"
},
{
"value": "2",
"key": "x-envoy-upstream-service-time"
},
{
"value": "nosniff",
"key": "x-content-type-options"
},
{
"value": "738d3502eba0a6ac-GRU",
"key": "cf-ray"
},
{
"value": "Origin",
"key": "Vary"
}
],
"responseLength": 0,
"requestLength": 0,
"duration": 170
}
```
Contributor guide
Assessment
This issue has not been assessed yet.