dlxj commited on
Commit ·
ae559e0
1
Parent(s): 2021b5e
实现了本地 ts 单个视频播放,不依赖 node server
Browse filesFiles changed (4)
- core.js+46
- index.html+4
- package-lock.json+61-1
- package.json+2-1
4 unmodified lines567891095 unmodified lines1061071081091101114 unmodified linesconst spinner = document.getElementById("spinner");const channelsContainer = document.getElementById("channelsContainer");const fileInput = document.getElementById("m3uFile");let channels = []; // Array degli elementi canalelet currentSelectedIndex = -1;95 unmodified lines};reader.readAsText(file);});function updateSelection() {channels.forEach((channel, index) => {4 unmodified lines56789101195 unmodified lines1071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561574 unmodified linesconst spinner = document.getElementById("spinner");const channelsContainer = document.getElementById("channelsContainer");const fileInput = document.getElementById("m3uFile");const tsInput = document.getElementById("tsFile");let channels = []; // Array degli elementi canalelet currentSelectedIndex = -1;95 unmodified lines};reader.readAsText(file);});// Event listener per il file input TS: trasforma il file locale in MP4 tramite mux.js e lo riproducetsInput.addEventListener("change", function(event) {const file = event.target.files[0];if (!file) return;// Reset playerif (hls) {hls.destroy();hls = null;}// Crea un transmuxer MP4const transmuxer = new muxjs.mp4.Transmuxer();const reader = new FileReader();reader.onload = function(e) {const data = new Uint8Array(e.target.result);// Setup MediaSourceconst mime = 'video/mp4; codecs="avc1.42E01E,mp4a.40.2"';const mediaSource = new MediaSource();video.src = URL.createObjectURL(mediaSource);mediaSource.addEventListener('sourceopen', function() {const sourceBuffer = mediaSource.addSourceBuffer(mime);// Quando mux.js ha dei dati prontitransmuxer.on('data', (segment) => {const data = new Uint8Array(segment.initSegment.byteLength + segment.data.byteLength);data.set(segment.initSegment, 0);data.set(segment.data, segment.initSegment.byteLength);sourceBuffer.appendBuffer(data);});// Invia i dati al transmuxertransmuxer.push(data);transmuxer.flush();});video.play().catch(console.error);};reader.readAsArrayBuffer(file);});function updateSelection() {channels.forEach((channel, index) => {
5 unmodified lines678910116 unmodified lines1819202122235 unmodified lines<meta name="viewport" content="width=device-width, initial-scale=1.0"><!-- Include HLS.js via CDN --><script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script><!-- Custom CSS --><link rel="stylesheet" href="style.css"></head>6 unmodified lines<div class="file-input"><p>Upload the .m3u or .m3u8 file of your IPTV channels:</p><input type="file" id="m3uFile" accept=".m3u, .m3u8"><p>(You can interact with the player using mouse, touch, keyboard, gamepad, or remote control).</p></div><div class="main-container">5 unmodified lines6789101112136 unmodified lines20212223242526275 unmodified lines<meta name="viewport" content="width=device-width, initial-scale=1.0"><!-- Include HLS.js via CDN --><script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script><!-- Include mux.js for client-side transmuxing --><script src="./node_modules/mux.js/dist/mux.min.js"></script><!-- Custom CSS --><link rel="stylesheet" href="style.css"></head>6 unmodified lines<div class="file-input"><p>Upload the .m3u or .m3u8 file of your IPTV channels:</p><input type="file" id="m3uFile" accept=".m3u, .m3u8"><p>Or select a local .ts file to play directly:</p><input type="file" id="tsFile" accept=".ts"><p>(You can interact with the player using mouse, touch, keyboard, gamepad, or remote control).</p></div><div class="main-container">
8 unmodified lines9101112131415137 unmodified lines153154155156157158196 unmodified lines355356357358359360142 unmodified lines50350450550650750850951051151251351455 unmodified lines5705715725735745758 unmodified lines"version": "1.0.0","license": "ISC","dependencies": {"express": "^5.2.1"}},"node_modules/accepts": {137 unmodified lines"node": ">= 0.8"}},"node_modules/dunder-proto": {"version": "1.0.1","resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",196 unmodified lines"node": ">= 0.4"}},"node_modules/gopd": {"version": "1.2.0","resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",142 unmodified lines"url": "https://opencollective.com/express"}},"node_modules/ms": {"version": "2.1.3","resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz","integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==","license": "MIT"},"node_modules/negotiator": {"version": "1.0.0","resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz",55 unmodified lines"url": "https://opencollective.com/express"}},"node_modules/proxy-addr": {"version": "2.0.7","resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",8 unmodified lines910111213141516171819202122232425137 unmodified lines163164165166167168169170171172173196 unmodified lines370371372373374375376377378379380381382383384385142 unmodified lines52852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456555 unmodified lines6216226236246256266276286296306316326336346358 unmodified lines"version": "1.0.0","license": "ISC","dependencies": {"express": "^5.2.1","mux.js": "^6.3.0"}},"node_modules/@babel/runtime": {"version": "7.28.6","resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.28.6.tgz","integrity": "sha512-05WQkdpL9COIMz4LjTxGpPNCdlpyimKppYNoJ5Di5EUObifl8t4tuLuUBBZEpoLYOmfvIWrsp9fCl0HoPRVTdA==","license": "MIT","engines": {"node": ">=6.9.0"}},"node_modules/accepts": {137 unmodified lines"node": ">= 0.8"}},"node_modules/dom-walk": {"version": "0.1.2","resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.2.tgz","integrity": "sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w=="},"node_modules/dunder-proto": {"version": "1.0.1","resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",196 unmodified lines"node": ">= 0.4"}},"node_modules/global": {"version": "4.4.0","resolved": "https://registry.npmjs.org/global/-/global-4.4.0.tgz","integrity": "sha512-wv/LAoHdRE3BeTGz53FAamhGlPLhlssK45usmGFThIi4XqnBmjKQ16u+RNbP7WvigRZDxUsM0J3gcQ5yicaL0w==","license": "MIT","dependencies": {"min-document": "^2.19.0","process": "^0.11.10"}},"node_modules/gopd": {"version": "1.2.0","resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",142 unmodified lines"url": "https://opencollective.com/express"}},"node_modules/min-document": {"version": "2.19.2","resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.2.tgz","integrity": "sha512-8S5I8db/uZN8r9HSLFVWPdJCvYOejMcEC82VIzNUc6Zkklf/d1gg2psfE79/vyhWOj4+J8MtwmoOz3TmvaGu5A==","license": "MIT","dependencies": {"dom-walk": "^0.1.0"}},"node_modules/ms": {"version": "2.1.3","resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz","integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==","license": "MIT"},"node_modules/mux.js": {"version": "6.3.0","resolved": "https://registry.npmjs.org/mux.js/-/mux.js-6.3.0.tgz","integrity": "sha512-/QTkbSAP2+w1nxV+qTcumSDN5PA98P0tjrADijIzQHe85oBK3Akhy9AHlH0ne/GombLMz1rLyvVsmrgRxoPDrQ==","license": "Apache-2.0","dependencies": {"@babel/runtime": "^7.11.2","global": "^4.4.0"},"bin": {"muxjs-transmux": "bin/transmux.js"},"engines": {"node": ">=8","npm": ">=5"}},"node_modules/negotiator": {"version": "1.0.0","resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz",55 unmodified lines"url": "https://opencollective.com/express"}},"node_modules/process": {"version": "0.11.10","resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz","integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==","license": "MIT","engines": {"node": ">= 0.6.0"}},"node_modules/proxy-addr": {"version": "2.0.7","resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
14 unmodified lines15161718192014 unmodified lines"author": "","license": "ISC","dependencies": {"express": "^5.2.1"}}14 unmodified lines1516171819202114 unmodified lines"author": "","license": "ISC","dependencies": {"express": "^5.2.1","mux.js": "^6.3.0"}}
core.js+46
index.html+4
package-lock.json+61-1
package.json+2-1