@warren-bank/hls-proxy 0.21.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -215,6 +215,8 @@ options:
215
215
  * return value:
216
216
  * _Object_ containing key:value pairs that are combined with _--req-headers_
217
217
  * each _key_ is the name of an HTTP header to send in the outbound request to `url`
218
+ * `"modify_m3u8_content": (m3u8_content, m3u8_url) => new_m3u8_content`
219
+ * conditionally modify the content of .m3u8 files __before__ they are parsed to extract URLs
218
220
  * `"redirect": (url) => new_url`
219
221
  * conditionally redirect the URLs encountered in .m3u8 files __before__ they are modified to pass through the proxy
220
222
  * `"prefetch": (url) => boolean`
@@ -103,6 +103,10 @@ const proxy = function({server, host, is_secure, req_headers, req_options, hooks
103
103
  )}
104
104
 
105
105
  const modify_m3u8_content = function(m3u8_content, m3u8_url, referer_url) {
106
+ if (hooks && (hooks instanceof Object) && hooks.modify_m3u8_content && (typeof hooks.modify_m3u8_content === 'function')) {
107
+ m3u8_content = hooks.modify_m3u8_content(m3u8_content, m3u8_url) || m3u8_content
108
+ }
109
+
106
110
  const base_urls = {
107
111
  "relative": m3u8_url.replace(/[\?#].*$/, '').replace(/[^\/]+$/, ''),
108
112
  "absolute": m3u8_url.replace(/(:\/\/[^\/]+).*$/, '$1')
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@warren-bank/hls-proxy",
3
3
  "description": "Node.js server to proxy HLS video streams",
4
- "version": "0.21.0",
4
+ "version": "1.0.0",
5
5
  "scripts": {
6
6
  "start": "node hls-proxy/bin/hlsd.js",
7
7
  "sudo": "sudo node hls-proxy/bin/hlsd.js"