Closed internetxs closed 3 years ago
I can't understand this question. Could you please explain in more detail?
I'd suggest using Nginx or Apache as reverse HTTP proxy to handle TLS encryption and adding headers as desired. Alternatively, you could add the desired http headers here and then recompile OME: https://github.com/AirenSoft/OvenMediaEngine/blob/master/src/projects/publishers/segment/segment_stream/segment_stream_server.cpp#L240
I wonder what http headers for caching you want to set. I'd guess only disabling caching or limiting it to a very short time?
ideally when using caching the manifest should be able to be cached for 2 seconds and then expire. For example when using HLS the caching on the TS files could be set to 300 seconds for example then if your able to use a cdn on front it allows you to serve cached content to your watchers
In the playlist.m3u8 Access-Control-Allow-Origin: * Cache-Control: no-cache, no-store, must-revalidate Content-Length: 151 Content-Type: application/vnd.apple.mpegurl Expires: 0 Pragma: no-cache Server: OvenMediaEngine
In the ts file: Access-Control-Allow-Origin: * Content-Length: 1211660 Content-Type: video/MP2T Server: OvenMediaEngine
and same applies for dash
Caching ts files for more than maybe 15 seconds on CDN or client would either require a different .ts file naming scheme (so the same path + file name will not be reused for different content), or it would break stopping and then restarting live-streaming.
Caching ts files for more than maybe 15 seconds on CDN or client would either require a different .ts file naming scheme (so the same path + file name will not be reused for different content), or it would break stopping and then restarting live-streaming.
In the meantime i found which files to edit. currently compiling to see the results
issue can be closed found the issue and added the headers manually
Could you maybe document your changes or maybe even do a pull request?
Hi the changes that i made:
Under hls_stream_server.cpp from line 63
// Set HTTP header
response->SetHeader("Content-Type", "application/vnd.apple.mpegurl");
// response->SetHeader("Cache-Control", "no-cache, no-store, must-revalidate"); response->SetHeader("Cache-Control", "max-age=2"); // response->SetHeader("Pragma", "no-cache"); // response->SetHeader("Expires", "0");
From line 105
// Set HTTP header response->SetHeader("Cache-Control", "max-age=300"); response->SetHeader("Content-Type", "video/MP2T"); response->AppendData(segment->data); auto sent_bytes = response->Response();
@internetxs I will add a task to our backlog that allows the user to control this in the config file. Thanks for sharing the information.
Caching ts files for more than maybe 15 seconds on CDN or client would either require a different .ts file naming scheme (so the same path + file name will not be reused for different content), or it would break stopping and then restarting live-streaming.
it would be an good idea to have the naming in epoch timeformat then it's always unique
I will add a task to our backlog that allows the user to control this in the config file. Thanks for sharing the information.
Hi @getroot did this ever become an option? I am troubleshooting for a customer whose endpoint cannot read the "application/vnd.apple.mpegurl" content-type.
How can i set the caching and http headers?