2
0
mirror of https://github.com/ad1217/PrinterStatus synced 2024-12-24 18:45:41 -05:00

Replace video.js with vime

video.js still hasn't updated their types for v8 and now v7 is broken
too, so I'm just ditching it for another library
This commit is contained in:
Adam Goldsmith 2023-09-14 14:05:26 -04:00
parent 5766009a44
commit b7661a40a2
3 changed files with 82 additions and 196 deletions

View File

@ -7,7 +7,6 @@
"version": "0.0.0",
"type": "module",
"devDependencies": {
"@types/video.js": "^7.3.52",
"@vitejs/plugin-vue": "^4.3.4",
"sass": "^1.67.0",
"typescript": "^5.2.2",
@ -16,9 +15,10 @@
},
"dependencies": {
"@popperjs/core": "^2.11.8",
"@vime/core": "^5.4.1",
"@vime/vue-next": "^5.4.1",
"bootstrap": "^5.3.2",
"pretty-ms": "^8.0.0",
"video.js": "^7.21.5",
"vue": "^3.3.4"
},
"scripts": {

215
pnpm-lock.yaml generated
View File

@ -8,23 +8,23 @@ dependencies:
'@popperjs/core':
specifier: ^2.11.8
version: 2.11.8
'@vime/core':
specifier: ^5.4.1
version: 5.4.1
'@vime/vue-next':
specifier: ^5.4.1
version: 5.4.1(@vime/core@5.4.1)(vue@3.3.4)
bootstrap:
specifier: ^5.3.2
version: 5.3.2(@popperjs/core@2.11.8)
pretty-ms:
specifier: ^8.0.0
version: 8.0.0
video.js:
specifier: ^7.21.5
version: 7.21.5
vue:
specifier: ^3.3.4
version: 3.3.4
devDependencies:
'@types/video.js':
specifier: ^7.3.52
version: 7.3.52
'@vitejs/plugin-vue':
specifier: ^4.3.4
version: 4.3.4(vite@4.4.9)(vue@3.3.4)
@ -58,13 +58,6 @@ packages:
dependencies:
'@babel/types': 7.22.17
/@babel/runtime@7.22.15:
resolution: {integrity: sha512-T0O+aa+4w0u06iNmapipJXMV4HoUir03hpx3/YqXXhu9xim3w+dVphjFWl1OH8NbZHw5Lbm9k45drDkgq2VNNA==}
engines: {node: '>=6.9.0'}
dependencies:
regenerator-runtime: 0.14.0
dev: false
/@babel/types@7.22.17:
resolution: {integrity: sha512-YSQPHLFtQNE5xN9tHuZnzu8vPr61wVTBZdfv1meex1NBosa4iT05k/Jw06ddJugi4bk7The/oSwQGFcksmEJQg==}
engines: {node: '>=6.9.0'}
@ -278,41 +271,35 @@ packages:
resolution: {integrity: sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==}
dev: false
/@types/video.js@7.3.52:
resolution: {integrity: sha512-WFj/HkNVCfkchXDeDU0QbimC356FB5vva3g5mgsjk8n3UMKqP9S522rQAmu9LGPiCmShZRPuAlkXmbp5WId6ow==}
dev: true
/@stencil/core@2.5.2:
resolution: {integrity: sha512-bgjPXkSzzg1WnTgVUm6m5ZzpKt602WmA/QljODAW1xVN40OHJdbGblzF/F6MFzqv2c5Cy30CB41arc8qADIdcQ==}
engines: {node: '>=12.10.0', npm: '>=6.0.0'}
hasBin: true
dev: false
/@videojs/http-streaming@2.16.2(video.js@7.21.5):
resolution: {integrity: sha512-etPTUdCFu7gUWc+1XcbiPr+lrhOcBu3rV5OL1M+3PDW89zskScAkkcdqYzP4pFodBPye/ydamQoTDScOnElw5A==}
engines: {node: '>=8', npm: '>=5'}
/@types/fscreen@1.0.2:
resolution: {integrity: sha512-mcLTUz/csZ0orKbsPUXCRLs+NTK7+LWX52id+ws7HSsu/wMeuX3320Bpq+zeAfxGw0gPUVhuUozuvKbmsB+u6A==}
dev: false
/@vime/core@5.4.1:
resolution: {integrity: sha512-ZFpV3xqZJ5tvh5rZOYKRh8zFzNIKr2ZcK6L75nJjFjbWt/ZmFF2nMBxtD9/hC4Xjk9v7hp1+P9cmctL674VFgA==}
dependencies:
'@stencil/core': 2.5.2
'@types/fscreen': 1.0.2
fscreen: 1.2.0
mitt: 3.0.1
stencil-wormhole: 3.4.1
dev: false
/@vime/vue-next@5.4.1(@vime/core@5.4.1)(vue@3.3.4):
resolution: {integrity: sha512-2zy2FfSSPmX7AwnZAoOoYx8CdU6NT9hTZD1lYwr6n5+4gKanaPCK5+5ab0GHlv3+8SuAaO5jLUJG3G12lf6LYw==}
requiresBuild: true
peerDependencies:
video.js: ^6 || ^7
'@vime/core': 5.4.1
vue: ^3.0.0
dependencies:
'@babel/runtime': 7.22.15
'@videojs/vhs-utils': 3.0.5
aes-decrypter: 3.1.3
global: 4.4.0
m3u8-parser: 4.8.0
mpd-parser: 0.22.1
mux.js: 6.0.1
video.js: 7.21.5
dev: false
/@videojs/vhs-utils@3.0.5:
resolution: {integrity: sha512-PKVgdo8/GReqdx512F+ombhS+Bzogiofy1LgAj4tN8PfdBx3HSS7V5WfJotKTqtOWGwVfSWsrYN/t09/DSryrw==}
engines: {node: '>=8', npm: '>=5'}
dependencies:
'@babel/runtime': 7.22.15
global: 4.4.0
url-toolkit: 2.2.5
dev: false
/@videojs/xhr@2.6.0:
resolution: {integrity: sha512-7J361GiN1tXpm+gd0xz2QWr3xNWBE+rytvo8J3KuggFaLg+U37gZQ2BuPLcnkfGffy2e+ozY70RHC8jt7zjA6Q==}
dependencies:
'@babel/runtime': 7.22.15
global: 4.4.0
is-function: 1.0.2
'@vime/core': 5.4.1
vue: 3.3.4
dev: false
/@vitejs/plugin-vue@4.3.4(vite@4.4.9)(vue@3.3.4):
@ -445,20 +432,6 @@ packages:
- typescript
dev: true
/@xmldom/xmldom@0.8.10:
resolution: {integrity: sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw==}
engines: {node: '>=10.0.0'}
dev: false
/aes-decrypter@3.1.3:
resolution: {integrity: sha512-VkG9g4BbhMBy+N5/XodDeV6F02chEk9IpgRTq/0bS80y4dzy79VH2Gtms02VXomf3HmyRe3yyJYkJ990ns+d6A==}
dependencies:
'@babel/runtime': 7.22.15
'@videojs/vhs-utils': 3.0.5
global: 4.4.0
pkcs7: 1.0.4
dev: false
/anymatch@3.1.3:
resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==}
engines: {node: '>= 8'}
@ -519,10 +492,6 @@ packages:
resolution: {integrity: sha512-e/1zu3xH5MQryN2zdVaF0OrdNLUbvWxzMbi+iNA6Bky7l1RoP8a2fIbRocyHclXt/arDrrR6lL3TqFD9pMQTsg==}
dev: true
/dom-walk@0.1.2:
resolution: {integrity: sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w==}
dev: false
/esbuild@0.18.20:
resolution: {integrity: sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA==}
engines: {node: '>=12'}
@ -563,6 +532,10 @@ packages:
to-regex-range: 5.0.1
dev: true
/fscreen@1.2.0:
resolution: {integrity: sha512-hlq4+BU0hlPmwsFjwGGzZ+OZ9N/wq9Ljg/sq3pX+2CD7hrJsX9tJgWWK/wiNTFM212CLHWhicOoqwXyZGGetJg==}
dev: false
/fsevents@2.3.3:
resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==}
engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
@ -578,13 +551,6 @@ packages:
is-glob: 4.0.3
dev: true
/global@4.4.0:
resolution: {integrity: sha512-wv/LAoHdRE3BeTGz53FAamhGlPLhlssK45usmGFThIi4XqnBmjKQ16u+RNbP7WvigRZDxUsM0J3gcQ5yicaL0w==}
dependencies:
min-document: 2.19.0
process: 0.11.10
dev: false
/he@1.2.0:
resolution: {integrity: sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==}
hasBin: true
@ -594,10 +560,6 @@ packages:
resolution: {integrity: sha512-fsXeu4J4i6WNWSikpI88v/PcVflZz+6kMhUfIwc5SY+poQRPnaf5V7qds6SUyUN3cVxEzuCab7QIoLOQ+DQ1wA==}
dev: true
/individual@2.0.0:
resolution: {integrity: sha512-pWt8hBCqJsUWI/HtcfWod7+N9SgAqyPEaF7JQjwzjn5vGrpg6aQ5qeAFQ7dx//UH4J1O+7xqew+gCeeFt6xN/g==}
dev: false
/is-binary-path@2.1.0:
resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==}
engines: {node: '>=8'}
@ -610,10 +572,6 @@ packages:
engines: {node: '>=0.10.0'}
dev: true
/is-function@1.0.2:
resolution: {integrity: sha512-lw7DUp0aWXYg+CBCN+JKkcE0Q2RayZnSvnZBlwgxHBQhqt5pZNVy4Ri7H9GmmXkdu7LUthszM+Tor1u/2iBcpQ==}
dev: false
/is-glob@4.0.3:
resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==}
engines: {node: '>=0.10.0'}
@ -626,10 +584,6 @@ packages:
engines: {node: '>=0.12.0'}
dev: true
/keycode@2.2.1:
resolution: {integrity: sha512-Rdgz9Hl9Iv4QKi8b0OlCRQEzp4AgVxyCtz5S/+VIHezDmrDhkp2N2TqBWOLz0/gbeREXOOiI9/4b8BY9uw2vFg==}
dev: false
/lru-cache@6.0.0:
resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==}
engines: {node: '>=10'}
@ -637,26 +591,12 @@ packages:
yallist: 4.0.0
dev: true
/m3u8-parser@4.8.0:
resolution: {integrity: sha512-UqA2a/Pw3liR6Df3gwxrqghCP17OpPlQj6RBPLYygf/ZSQ4MoSgvdvhvt35qV+3NaaA0FSZx93Ix+2brT1U7cA==}
dependencies:
'@babel/runtime': 7.22.15
'@videojs/vhs-utils': 3.0.5
global: 4.4.0
dev: false
/magic-string@0.30.3:
resolution: {integrity: sha512-B7xGbll2fG/VjP+SWg4sX3JynwIU0mjoTc6MPpKNuIvftk6u6vqhDnk1R80b8C2GBR6ywqy+1DcKBrevBg+bmw==}
engines: {node: '>=12'}
dependencies:
'@jridgewell/sourcemap-codec': 1.4.15
/min-document@2.19.0:
resolution: {integrity: sha512-9Wy1B3m3f66bPPmU5hdA4DR4PB2OfDU/+GS3yAB7IQozE3tqXaVv2zOjgla7MEGSRv95+ILmOuvhLkOK6wJtCQ==}
dependencies:
dom-walk: 0.1.2
dev: false
/minimatch@9.0.3:
resolution: {integrity: sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==}
engines: {node: '>=16 || 14 >=14.17'}
@ -664,29 +604,14 @@ packages:
brace-expansion: 2.0.1
dev: true
/mpd-parser@0.22.1:
resolution: {integrity: sha512-fwBebvpyPUU8bOzvhX0VQZgSohncbgYwUyJJoTSNpmy7ccD2ryiCvM7oRkn/xQH5cv73/xU7rJSNCLjdGFor0Q==}
hasBin: true
dependencies:
'@babel/runtime': 7.22.15
'@videojs/vhs-utils': 3.0.5
'@xmldom/xmldom': 0.8.10
global: 4.4.0
/mitt@3.0.1:
resolution: {integrity: sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==}
dev: false
/muggle-string@0.3.1:
resolution: {integrity: sha512-ckmWDJjphvd/FvZawgygcUeQCxzvohjFO5RxTjj4eq8kw359gFF3E1brjfI+viLMxss5JrHTDRHZvu2/tuy0Qg==}
dev: true
/mux.js@6.0.1:
resolution: {integrity: sha512-22CHb59rH8pWGcPGW5Og7JngJ9s+z4XuSlYvnxhLuc58cA1WqGDQPzuG8I+sPm1/p0CdgpzVTaKW408k5DNn8w==}
engines: {node: '>=8', npm: '>=5'}
hasBin: true
dependencies:
'@babel/runtime': 7.22.15
global: 4.4.0
dev: false
/nanoid@3.3.6:
resolution: {integrity: sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==}
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
@ -710,13 +635,6 @@ packages:
engines: {node: '>=8.6'}
dev: true
/pkcs7@1.0.4:
resolution: {integrity: sha512-afRERtHn54AlwaF2/+LFszyAANTCggGilmcmILUzEjvs3XgFZT+xE6+QWQcAGmu4xajy+Xtj7acLOPdx5/eXWQ==}
hasBin: true
dependencies:
'@babel/runtime': 7.22.15
dev: false
/postcss@8.4.29:
resolution: {integrity: sha512-cbI+jaqIeu/VGqXEarWkRCCffhjgXc0qjBtXpqJhTBohMUjUQnbBr0xqX3vEKudc4iviTewcJo5ajcec5+wdJw==}
engines: {node: ^10 || ^12 || >=14}
@ -732,11 +650,6 @@ packages:
parse-ms: 3.0.0
dev: false
/process@0.11.10:
resolution: {integrity: sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==}
engines: {node: '>= 0.6.0'}
dev: false
/readdirp@3.6.0:
resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==}
engines: {node: '>=8.10.0'}
@ -744,10 +657,6 @@ packages:
picomatch: 2.3.1
dev: true
/regenerator-runtime@0.14.0:
resolution: {integrity: sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA==}
dev: false
/rollup@3.29.1:
resolution: {integrity: sha512-c+ebvQz0VIH4KhhCpDsI+Bik0eT8ZFEVZEYw0cGMVqIP8zc+gnwl7iXCamTw7vzv2MeuZFZfdx5JJIq+ehzDlg==}
engines: {node: '>=14.18.0', npm: '>=8.0.0'}
@ -756,18 +665,6 @@ packages:
fsevents: 2.3.3
dev: true
/rust-result@1.0.0:
resolution: {integrity: sha512-6cJzSBU+J/RJCF063onnQf0cDUOHs9uZI1oroSGnHOph+CQTIJ5Pp2hK5kEQq1+7yE/EEWfulSNXAQ2jikPthA==}
dependencies:
individual: 2.0.0
dev: false
/safe-json-parse@4.0.0:
resolution: {integrity: sha512-RjZPPHugjK0TOzFrLZ8inw44s9bKox99/0AZW9o/BEQVrJfhI+fIHMErnPyRa89/yRXUUr93q+tiN6zhoVV4wQ==}
dependencies:
rust-result: 1.0.0
dev: false
/sass@1.67.0:
resolution: {integrity: sha512-SVrO9ZeX/QQyEGtuZYCVxoeAL5vGlYjJ9p4i4HFuekWl8y/LtJ7tJc10Z+ck1c8xOuoBm2MYzcLfTAffD0pl/A==}
engines: {node: '>=14.0.0'}
@ -790,6 +687,10 @@ packages:
resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==}
engines: {node: '>=0.10.0'}
/stencil-wormhole@3.4.1:
resolution: {integrity: sha512-ppYTcWTJnIl4ZAKwF39LTA9f/ypHfbVefsHdN2hpMQGrR57wt1TieZo9tlCM/r1Y4SFiZ5yz/cjho564C921Xw==}
dev: false
/to-fast-properties@2.0.0:
resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==}
engines: {node: '>=4'}
@ -807,38 +708,6 @@ packages:
hasBin: true
dev: true
/url-toolkit@2.2.5:
resolution: {integrity: sha512-mtN6xk+Nac+oyJ/PrI7tzfmomRVNFIWKUbG8jdYFt52hxbiReFAXIjYskvu64/dvuW71IcB7lV8l0HvZMac6Jg==}
dev: false
/video.js@7.21.5:
resolution: {integrity: sha512-WRq86tXZKrThA9mK+IR+v4tIQVVvnb5LhvL71fD2AX7TxVOPdaeK1X/wyuUruBqWaOG3w2sZXoMY6HF2Jlo9qA==}
dependencies:
'@babel/runtime': 7.22.15
'@videojs/http-streaming': 2.16.2(video.js@7.21.5)
'@videojs/vhs-utils': 3.0.5
'@videojs/xhr': 2.6.0
aes-decrypter: 3.1.3
global: 4.4.0
keycode: 2.2.1
m3u8-parser: 4.8.0
mpd-parser: 0.22.1
mux.js: 6.0.1
safe-json-parse: 4.0.0
videojs-font: 3.2.0
videojs-vtt.js: 0.15.5
dev: false
/videojs-font@3.2.0:
resolution: {integrity: sha512-g8vHMKK2/JGorSfqAZQUmYYNnXmfec4MLhwtEFS+mMs2IDY398GLysy6BH6K+aS1KMNu/xWZ8Sue/X/mdQPliA==}
dev: false
/videojs-vtt.js@0.15.5:
resolution: {integrity: sha512-yZbBxvA7QMYn15Lr/ZfhhLPrNpI/RmCSCqgIff57GC2gIrV5YfyzLfLyZMj0NnZSAz8syB4N0nHXpZg9MyrMOQ==}
dependencies:
global: 4.4.0
dev: false
/vite@4.4.9(sass@1.67.0):
resolution: {integrity: sha512-2mbUn2LlUmNASWwSCNSJ/EG2HuSRTnVNaydp6vMCm5VIqJsjMfbIWtbH2kDuwUVW5mMUKKZvGPX/rqeqVvv1XA==}
engines: {node: ^14.18.0 || >=16.0.0}

View File

@ -3,16 +3,33 @@
<h3 class="card-header" :data-color="color">
{{ name || 'Unknown' }}
</h3>
<video-js
ref="video"
class="card-img vjs-4-3"
controls
<Player
class="card-img"
playsinline
autoplay
:autopause="false"
aspectRatio="4:3"
muted
preload="auto"
ref="player"
>
<source :src="`/webcam/${slug}.m3u8`" />
</video-js>
<Hls :config="{ liveDurationInfinity: true }">
<source
:data-src="`/webcam/${slug}.m3u8`"
type="application/x-mpegURL"
/>
</Hls>
<Ui>
<Spinner />
<LoadingScreen />
<Scrim gradient="up" />
<Controls :activeDuration="500" hideOnMouseLeave waitForPlaybackStart>
<LiveIndicator />
<ControlSpacer />
<FullscreenControl />
</Controls>
<DblClickFullscreen />
</Ui>
</Player>
<div class="card-body" v-if="status">
<div>{{ status.state.text }}</div>
@ -54,8 +71,20 @@
</template>
<script setup lang="ts">
import videojs from 'video.js';
import 'video.js/dist/video-js.css';
import {
Player,
Hls,
Ui,
Spinner,
LoadingScreen,
Scrim,
DblClickFullscreen,
Controls,
LiveIndicator,
ControlSpacer,
FullscreenControl,
} from '@vime/vue-next';
import '@vime/core/themes/default.css';
import { computed, Ref, ref, watchEffect } from 'vue';
import prettyMilliseconds from 'pretty-ms';
@ -75,8 +104,6 @@ export type PrinterInfo = Omit<Props, 'slug' | 'now'>;
const props = defineProps<Props>();
const video: Ref<HTMLMediaElement | null> = ref(null);
function formatDuration(seconds: number): string {
return prettyMilliseconds(seconds * 1000);
}
@ -95,16 +122,6 @@ const lastUpdateString = computed(() => {
}
}
});
watchEffect(() => {
if (video.value) {
// if video element valid, bind to videojs
videojs(video.value, {
liveui: true,
liveTracker: { trackingThreshold: 0 },
});
}
});
</script>
<style lang="scss">