I have the following setup for a streaming app. EMX -> EML -> S3 -> LAMBDA -> EMP. When I try to make a put request to mediapackage hls ingest endpoint, I get a 201.
def postStreamToMediaPackage(envVariables, fileName, content, contentType):
mediaPackageUrl = envVariables["url"]
username = envVariables["username"]
password = envVariables["password"]
ingestUrl = f"{mediaPackageUrl.rstrip('/channel')}/{fileName}" # not sure what mediapackage wants.
response = requests.put(
ingestUrl, data=content, headers={
"ContentType": contentType
}, auth=HTTPDigestAuth(username, password))
if response.status_code != 201:
print(
f"Error ingesting file {fileName} to {ingestUrl}. error: {response.text}")
return {"ingestUrl": ingestUrl, "fileName": fileName, "status": response.status_code}
But if i check mediapackage ingress access logs,
I can see for every file I send, it logs it twice, one that says 401
and the other one as a 201
.
I've also noticed that the root manifest gets a 404 if I send it to `channel/{root manifest name}.m3u8 but any other endpoint gets the same behaviour as mentioned previously To test this, I connected EML to EMP directly and enabled logging and can see that the request is send in the following style
channel_filename
for all files
`channel_timestamp_sequence.ts for ts files
.m3u8
for root manifest
I've tried everything I can to get a positive response from mediapackage origin endpoint but it always returns a 404 for manifest.
Mediapackage hls ingest is a webDav server.
Has anyone tried doing this? I can't find any useful doc that says how they expect these.
After a lot of twiddling and tinkering, we discovered that mediapackage needs the following file name structure to get a successful push.
if fileName == "index.m3u8": # this is your root manifest
ingestUrl = f"{mediaPackageUrl}.m3u8"
else:
ingestUrl = mediaPackageUrl.replace('channel', fileName) # for all other resources, you need to feed it to the root endpoint.