lucas42 / lucos_media_seinn Goto Github PK
View Code? Open in Web Editor NEWMedia Player for lucos
Media Player for lucos
At the moment, the chrome receiver needs starting manually by pressing the chromecast button in the UI. It'd be nice to automatically start the receiver app somehow.
(Perhaps running something on a raspberry pi on the same network as the cast devices - would that give it sufficient access to start the receiver app?)
It'd be nice to have a quick visual indicator in the UI which show how out-of-sync the server is with current actions.
Currently this app includes source code for the following modules, which are now available on npm:
Switch to using the npm ones so it's easier to keep reusable logic up-to-date across apps, and remove the corresponding source code from here.
Depends on #42 as the npm versions of the modules all expose ES Module interfaces.
At the moment, the lyrics viewer keeps its scroll position if a new song comes on with new lyrics.
Worth scrolling to the top in this case. (Probably do it any time the lyrics change, to be honest, even if it's the same track)
This happens for the lyrics overlay, should do the same for devices
Use of the beacon API isn't really working under flakey network conditions.
Replace it with a local cache of pending network requests. Can also use the cache to apply pending modifications to data received from server.
There appears to be a race condition in how the chrome library is being loaded. Look for a different approach so it consistently loads in the correct order.
Currently uses commonjs. Switch to ES modules for consistency with other apps.
May want to switch from browserify to webpack for build step as part of this.
For example of something already doing this, see lucos_notes v2.
Currently some failing fetch errors in v3.js throw uncaught exceptions which cause the whole app to crash.
Example log:
/usr/src/app/node_modules/node-fetch/lib/index.js:1461
reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err));
^
FetchError: request to https://ceol.l42.eu/poll/summary failed, reason: getaddrinfo EAI_AGAIN ceol.l42.eu
at ClientRequest.<anonymous> (/usr/src/app/node_modules/node-fetch/lib/index.js:1461:11)
at ClientRequest.emit (node:events:394:28)
at TLSSocket.socketErrorListener (node:_http_client:447:9)
at TLSSocket.emit (node:events:394:28)
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
type: 'system',
errno: 'EAI_AGAIN',
code: 'EAI_AGAIN'
}
Moving to native fetch instead of node-fetch module seems to have resulted in HTTP errors causing the server to crash.
App listening on port 3001
(node:20) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
node:internal/deps/undici/undici:6970
fetchParams.controller.controller.error(new TypeError("terminated", {
^
TypeError: terminated
at Fetch.onAborted (node:internal/deps/undici/undici:6970:53)
at Fetch.emit (node:events:513:28)
at Fetch.terminate (node:internal/deps/undici/undici:6223:14)
at Object.onError (node:internal/deps/undici/undici:7061:36)
at Request.onError (node:internal/deps/undici/undici:2550:31)
at errorRequest (node:internal/deps/undici/undici:4461:17)
at TLSSocket.onSocketClose (node:internal/deps/undici/undici:3923:9)
at TLSSocket.emit (node:events:525:35)
at node:net:757:14
at TCP.done (node:_tls_wrap:583:7) {
[cause]: SocketError: other side closed
at TLSSocket.onSocketEnd (node:internal/deps/undici/undici:3905:26)
at TLSSocket.emit (node:events:525:35)
at endReadableNT (node:internal/streams/readable:1359:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
code: 'UND_ERR_SOCKET',
socket: {
localAddress: '172.27.0.2',
localPort: 44532,
remoteAddress: '178.32.218.44',
remotePort: 443,
remoteFamily: 'IPv4',
timeout: undefined,
bytesWritten: 184,
bytesRead: 216
}
}
}
Node.js v18.7.0
All other media projects begin with lucos_media_
- align to that for consistency
Since service worker has been added, the player consistently crashes on chromecast devices.
Look into the best way to avoid this (it might be some sort of feature detection to prevent service workers being used on chromecast).
It's made trickier because:
For audio with no video, consider real time visualisations.
At the moment, when switching devices, playback resumes from the last time the previous device sent a message to the server.
This is fine if the previous device is the one instigating the device switch, as the device switch message includes the latest update. But for other devices, there can be a fair bit of lag between these times.
It seems like there's a loop between volume instructions between the cast-receiver and the server.
The state of a track can be fetching
either because the page itself is fetching it, or the service worker is preloading it.
For direct requests from the page, these show up with a "fetching" state in the UI. However, fetches from the service worker appear to still show as "unloaded" then jump straight to "downloaded" when they're completed.
Poll requests from the service worker aren't send the device's uuid. This mean the server doesn't register the device as active, so it doesn't show up on other devices' device lists (unless it's the one currently playing)
When lucos_media_manager gets restarted (eg on deploy) it loses its device list as it has no persistence. This is normally fine as players will register their presence when they next connect to it. However if a player is already connected, it appears it doesn't get added to the device list until the player is refreshed.
Authentication would prevent others randomly changing track.
It could also be built upon to allow each user to have their own playlist.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.