1
0
mirror of https://github.com/algora-io/tv.git synced 2025-03-17 20:17:45 +02:00

set content_type of stored media

This commit is contained in:
zafer 2024-06-02 17:14:54 +03:00
parent 2f73c9bd9c
commit a11c6d638b
2 changed files with 10 additions and 2 deletions

View File

@ -95,7 +95,8 @@ defmodule Algora.Library do
cb.(%{stage: :transmuxing, done: 1, total: 1})
System.cmd("ffmpeg", ["-i", video.url, "-c", "copy", mp4_local_path])
Storage.upload_from_filename(mp4_local_path, mp4_remote_path, cb)
Storage.upload_from_filename(mp4_local_path, mp4_remote_path, cb, content_type: "video/mp4")
mp4_video = Repo.insert!(mp4_video)
File.rm!(mp4_local_path)

View File

@ -41,7 +41,14 @@ defmodule Algora.Storage do
end
defp upload_opts(%{type: :manifest} = _ctx) do
[{:cache_control, "no-cache, no-store, private"}]
[
content_type: "application/x-mpegURL",
cache_control: "no-cache, no-store, private"
]
end
defp upload_opts(%{type: :segment} = _ctx) do
[content_type: "video/mp4"]
end
defp upload_opts(_ctx), do: []