diff --git a/docker/main/build_nginx.sh b/docker/main/build_nginx.sh index 708a4cb45c..7809620dd2 100755 --- a/docker/main/build_nginx.sh +++ b/docker/main/build_nginx.sh @@ -2,9 +2,8 @@ set -euxo pipefail -NGINX_VERSION="1.27.4" -VOD_MODULE_VERSION="1.31" -SECURE_TOKEN_MODULE_VERSION="1.5" +NGINX_VERSION="1.30.7" +VOD_MODULE_VERSION="v1.9.1" SET_MISC_MODULE_VERSION="v0.33" NGX_DEVEL_KIT_VERSION="v0.3.3" @@ -31,32 +30,27 @@ wget -nv https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz tar -zxf nginx-${NGINX_VERSION}.tar.gz -C /tmp/nginx --strip-components=1 rm nginx-${NGINX_VERSION}.tar.gz mkdir /tmp/nginx-vod-module -wget -nv https://github.com/kaltura/nginx-vod-module/archive/refs/tags/${VOD_MODULE_VERSION}.tar.gz +wget -nv https://github.com/dio-az/nginx-vod-module/archive/refs/tags/${VOD_MODULE_VERSION}.tar.gz tar -zxf ${VOD_MODULE_VERSION}.tar.gz -C /tmp/nginx-vod-module --strip-components=1 rm ${VOD_MODULE_VERSION}.tar.gz # Patch MAX_CLIPS to allow more clips to be added than the default 128 sed -i 's/MAX_CLIPS (128)/MAX_CLIPS (1080)/g' /tmp/nginx-vod-module/vod/media_set.h patch -d /tmp/nginx-vod-module/ -p1 << 'EOF' ---- a/vod/avc_hevc_parser.c 2022-06-27 11:38:10.000000000 +0000 -+++ b/vod/avc_hevc_parser.c 2023-01-16 11:25:10.900521298 +0000 -@@ -3,6 +3,9 @@ +--- a/vod/avc_hevc_parser.c ++++ b/vod/avc_hevc_parser.c +@@ -2,6 +2,9 @@ + bool_t - avc_hevc_parser_rbsp_trailing_bits(bit_reader_state_t* reader) - { + avc_hevc_parser_rbsp_trailing_bits(bit_reader_state_t* reader) { + // https://github.com/blakeblackshear/frigate/issues/4572 + return TRUE; + uint32_t one_bit; - if (reader->stream.eof_reached) + if (reader->stream.eof_reached) { EOF -mkdir /tmp/nginx-secure-token-module -wget https://github.com/kaltura/nginx-secure-token-module/archive/refs/tags/${SECURE_TOKEN_MODULE_VERSION}.tar.gz -tar -zxf ${SECURE_TOKEN_MODULE_VERSION}.tar.gz -C /tmp/nginx-secure-token-module --strip-components=1 -rm ${SECURE_TOKEN_MODULE_VERSION}.tar.gz - mkdir /tmp/ngx_devel_kit wget https://github.com/vision5/ngx_devel_kit/archive/refs/tags/${NGX_DEVEL_KIT_VERSION}.tar.gz tar -zxf ${NGX_DEVEL_KIT_VERSION}.tar.gz -C /tmp/ngx_devel_kit --strip-components=1 @@ -80,7 +74,6 @@ cd /tmp/nginx --add-module=../ngx_devel_kit \ --add-module=../nginx-set-misc-module \ --add-module=../nginx-vod-module \ - --add-module=../nginx-secure-token-module \ --with-cc-opt="-O3 -Wno-error=implicit-fallthrough" make CC="ccache gcc" -j$(nproc) && make install diff --git a/docker/main/rootfs/usr/local/nginx/conf/nginx.conf b/docker/main/rootfs/usr/local/nginx/conf/nginx.conf index 34cfe966e5..956089a087 100644 --- a/docker/main/rootfs/usr/local/nginx/conf/nginx.conf +++ b/docker/main/rootfs/usr/local/nginx/conf/nginx.conf @@ -114,21 +114,23 @@ http { # Smaller segments, faster generation, better browser compatibility vod_hls_container_format fmp4; - secure_token $args; - secure_token_types application/vnd.apple.mpegurl; + # fMP4 playlists use EXT-X-MAP, which requires HLS protocol + # version 6 (RFC 8216 section 7); the module default is 4 + vod_hls_version 6; + + # Pass the playlist's query args (e.g. Home Assistant's authSig) on + # to every URL in it. These match the only URL endings vod writes + # with fmp4 and no subtitles. + sub_filter_types application/vnd.apple.mpegurl; + sub_filter_once off; + sub_filter '.m3u8' '.m3u8$is_args$args'; + sub_filter '.m4s' '.m4s$is_args$args'; + sub_filter '.mp4"' '.mp4$is_args$args"'; add_header Cache-Control "no-store"; expires off; keepalive_disable safari; - - # vod module returns 502 for non-existent media - # https://github.com/kaltura/nginx-vod-module/issues/468 - error_page 502 =404 /vod-not-found; - } - - location = /vod-not-found { - return 404; } location /stream/ { diff --git a/web/package-lock.json b/web/package-lock.json index 1497afb21f..5186f1ee23 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -1487,19 +1487,19 @@ } }, "node_modules/@playwright/test": { - "version": "1.59.1", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.59.1.tgz", - "integrity": "sha512-PG6q63nQg5c9rIi4/Z5lR5IVF7yU5MqmKaPOe0HSc0O2cX1fPi96sUQu5j7eo4gKCkB2AnNGoWt7y4/Xx3Kcqg==", + "version": "1.65.0", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.65.0.tgz", + "integrity": "sha512-iGURLGuKDLakSEl7Pgfv8h7f+XLT+V861Wfhz0zlEl5nyFuKUopdkFBPKqTllTUp06aOwPuH8iuUEb3yp3MpbQ==", "dev": true, "license": "Apache-2.0", "dependencies": { - "playwright": "1.59.1" + "playwright": "1.65.0" }, "bin": { "playwright": "cli.js" }, "engines": { - "node": ">=18" + "node": ">=20" } }, "node_modules/@radix-ui/number": { @@ -11558,50 +11558,32 @@ } }, "node_modules/playwright": { - "version": "1.59.1", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.59.1.tgz", - "integrity": "sha512-C8oWjPR3F81yljW9o5OxcWzfh6avkVwDD2VYdwIGqTkl+OGFISgypqzfu7dOe4QNLL2aqcWBmI3PMtLIK233lw==", + "version": "1.65.0", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.65.0.tgz", + "integrity": "sha512-F3AMWcR44qMBt4kq+6Kb6mX7bjGXshktKFOPULd7reED6ZJWevjbNRqysP7q+AATE9kdPEZBibex1BYsvpVoeA==", "dev": true, "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.59.1" + "playwright-core": "1.65.0" }, "bin": { "playwright": "cli.js" }, "engines": { - "node": ">=18" - }, - "optionalDependencies": { - "fsevents": "2.3.2" + "node": ">=20" } }, "node_modules/playwright-core": { - "version": "1.59.1", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.59.1.tgz", - "integrity": "sha512-HBV/RJg81z5BiiZ9yPzIiClYV/QMsDCKUyogwH9p3MCP6IYjUFu/MActgYAvK0oWyV9NlwM3GLBjADyWgydVyg==", + "version": "1.65.0", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.65.0.tgz", + "integrity": "sha512-vNSKgH6YqtN7cdT/L334zo0a+YwkrpicyrHJlWWPIm/Q+Nn2SWInil01oT0mbu96U4GgoRtCYQD9CzJQgju+lA==", "dev": true, "license": "Apache-2.0", "bin": { "playwright-core": "cli.js" }, "engines": { - "node": ">=18" - } - }, - "node_modules/playwright/node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + "node": ">=20" } }, "node_modules/postcss": { diff --git a/web/src/components/player/GenericVideoPlayer.tsx b/web/src/components/player/GenericVideoPlayer.tsx index 25399771bf..71128106bb 100644 --- a/web/src/components/player/GenericVideoPlayer.tsx +++ b/web/src/components/player/GenericVideoPlayer.tsx @@ -32,8 +32,8 @@ export function GenericVideoPlayer({ const checkSourceExists = async (url: string) => { try { const response = await fetch(url, { method: "HEAD" }); - // nginx vod module returns 502 for non existent media - // https://github.com/kaltura/nginx-vod-module/issues/468 + // missing media is a 404; 502 still covers a failed or + // unreachable mapping request, which is equally unplayable setSourceExists(response.status !== 502 && response.status !== 404); } catch (error) { setSourceExists(false);