From 1def826e8e509a7edf1d6b40c477bf6fbf52d81a Mon Sep 17 00:00:00 2001 From: jonathan Date: Mon, 31 Jan 2022 17:40:13 +0100 Subject: [PATCH] HTTP-FLV player for low latency (expermiental) --- docs/srs.conf | 38 ++++++++++++++++++++++++++++ package-lock.json | 51 +++++++++++++++++++++++++++++++++----- package.json | 1 + pages/player.vue | 41 +++++++++++++++++++++++++++++- test.html | 63 +++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 187 insertions(+), 7 deletions(-) create mode 100644 docs/srs.conf create mode 100644 test.html diff --git a/docs/srs.conf b/docs/srs.conf new file mode 100644 index 00000000..11ed0c41 --- /dev/null +++ b/docs/srs.conf @@ -0,0 +1,38 @@ +# srs HTTP-FLV example + +listen 1935; +max_connections 1000; +daemon off; +srs_log_tank console; +http_server { + enabled on; + listen 127.0.0.1:8080; + dir ./objs/nginx/html; +} + +vhost preview.local { + # needs redirect in /etc/hosts: + # 127.0.0.1 preview.local + http_remux { + enabled on; + mount [vhost]/[app]/[stream].flv; + } + +# low latency: +# tcp_nodelay on +# min_latency on; + +# play { +# gop_cache off; +# queue_length 10; +# mw_latency 100; +# } + +# publish { +# mr off; +# } +} + +vhost __defaultVhost__ { + +} diff --git a/package-lock.json b/package-lock.json index 9cd8abdb..8ea24a97 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,6 +16,7 @@ "cookie-universal-nuxt": "^2.1.5", "jwt-decode": "^3.1.2", "lodash": "^4.17.21", + "mpegts.js": "^1.6.10", "nuxt": "^2.15.8", "splitpanes": "^2.3.8", "video.js": "^7.17.0", @@ -6154,6 +6155,11 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/es6-promise": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" + }, "node_modules/escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", @@ -9765,6 +9771,15 @@ "mpd-to-m3u8-json": "bin/parse.js" } }, + "node_modules/mpegts.js": { + "version": "1.6.10", + "resolved": "https://registry.npmjs.org/mpegts.js/-/mpegts.js-1.6.10.tgz", + "integrity": "sha512-ZgX4b93cWk+EazOFRV4lekLqmc4rV7P+WMisG8N0F2M4/EiluPMNNWjuaurQfitak++AIc/ZVQ3IgM3cBcH7WA==", + "dependencies": { + "es6-promise": "^4.2.5", + "webworkify-webpack": "^2.1.5" + } + }, "node_modules/mrmime": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/mrmime/-/mrmime-1.0.0.tgz", @@ -14551,9 +14566,9 @@ } }, "node_modules/ufo": { - "version": "0.7.9", - "resolved": "https://registry.npmjs.org/ufo/-/ufo-0.7.9.tgz", - "integrity": "sha512-6t9LrLk3FhqTS+GW3IqlITtfRB5JAVr5MMNjpBECfK827W+Vh5Ilw/LhTcHWrt6b3hkeBvcbjx4Ti7QVFzmcww==" + "version": "0.7.10", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-0.7.10.tgz", + "integrity": "sha512-YTnDRlE1cIofRqOFN8ioAbz9qenDvkgVMSn0cnxvIDjM9sfEOMKB0ybMr+otSlCXMfQ/X35haYRoI7Nua82RrA==" }, "node_modules/uglify-js": { "version": "3.15.0", @@ -16320,6 +16335,11 @@ "node": ">=8" } }, + "node_modules/webworkify-webpack": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/webworkify-webpack/-/webworkify-webpack-2.1.5.tgz", + "integrity": "sha512-2akF8FIyUvbiBBdD+RoHpoTbHMQF2HwjcxfDvgztAX5YwbZNyrtfUMgvfgFVsgDhDPVTlkbb5vyasqDHfIDPQw==" + }, "node_modules/whatwg-url": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", @@ -21343,6 +21363,11 @@ "is-symbol": "^1.0.2" } }, + "es6-promise": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" + }, "escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", @@ -24056,6 +24081,15 @@ "global": "^4.4.0" } }, + "mpegts.js": { + "version": "1.6.10", + "resolved": "https://registry.npmjs.org/mpegts.js/-/mpegts.js-1.6.10.tgz", + "integrity": "sha512-ZgX4b93cWk+EazOFRV4lekLqmc4rV7P+WMisG8N0F2M4/EiluPMNNWjuaurQfitak++AIc/ZVQ3IgM3cBcH7WA==", + "requires": { + "es6-promise": "^4.2.5", + "webworkify-webpack": "^2.1.5" + } + }, "mrmime": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/mrmime/-/mrmime-1.0.0.tgz", @@ -27819,9 +27853,9 @@ "integrity": "sha512-qLK/Xe9E2uzmYI3qLeOmI0tEOt+TBBQyUIAh4aAgU05FVYzeZrKUdkAZfBNVGRaHVgV0TDkdEngJSw/SyQchkQ==" }, "ufo": { - "version": "0.7.9", - "resolved": "https://registry.npmjs.org/ufo/-/ufo-0.7.9.tgz", - "integrity": "sha512-6t9LrLk3FhqTS+GW3IqlITtfRB5JAVr5MMNjpBECfK827W+Vh5Ilw/LhTcHWrt6b3hkeBvcbjx4Ti7QVFzmcww==" + "version": "0.7.10", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-0.7.10.tgz", + "integrity": "sha512-YTnDRlE1cIofRqOFN8ioAbz9qenDvkgVMSn0cnxvIDjM9sfEOMKB0ybMr+otSlCXMfQ/X35haYRoI7Nua82RrA==" }, "uglify-js": { "version": "3.15.0", @@ -29212,6 +29246,11 @@ } } }, + "webworkify-webpack": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/webworkify-webpack/-/webworkify-webpack-2.1.5.tgz", + "integrity": "sha512-2akF8FIyUvbiBBdD+RoHpoTbHMQF2HwjcxfDvgztAX5YwbZNyrtfUMgvfgFVsgDhDPVTlkbb5vyasqDHfIDPQw==" + }, "whatwg-url": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", diff --git a/package.json b/package.json index 53434edc..d7ef9653 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "cookie-universal-nuxt": "^2.1.5", "jwt-decode": "^3.1.2", "lodash": "^4.17.21", + "mpegts.js": "^1.6.10", "nuxt": "^2.15.8", "splitpanes": "^2.3.8", "video.js": "^7.17.0", diff --git a/pages/player.vue b/pages/player.vue index a6ea6b87..0ec6976b 100644 --- a/pages/player.vue +++ b/pages/player.vue @@ -5,7 +5,13 @@ - + @@ -308,6 +314,7 @@ + + + + + + +