My video file can uploaded successfully. but i can't play it inside the browser. when i request it automatically downloaded. also i used "content-type: video/mp4" but when i request it's content type is binary/octet-stream
following is my python code.
def get_bucket_sign_url(upload_path):
try:
presigned_post = s3_client.generate_presigned_post(
Bucket=settings.AWS_STORAGE_BUCKET_NAME,
Key=upload_path",
Fields={"acl": "public-read", "Content-Type": 'video/mp4'},
Conditions=[
{"acl": "public-read"},
{"Content-Type": 'video/mp4'},
{"success_action_status": "200"}
],
ExpiresIn=settings.S3_MAX_TIMEOUT # 3600
)
return presigned_post
except Exception:
return {}
following is my curl code.
curl --location --request POST 'https://******.s3.amazonaws.com/' \
--form 'key=media/customer_videos/5556.mp4' \
--form 'file=@/home/user/Videos/ssm.mp4' \
--form 'acl=public-read' \
--form 'content-type=video/mp4' \
--form 'AWSAccessKeyId=*******' \
--form 'policy=******' \
--form 'signature=******'
Check metadata
in uploaded S3. The value field should be video/mp4
. Please refer the following screenshot
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With