WIP: [DEPRECATED] Chromecast Plugin #296
No reviewers
Labels
No labels
awaiting-reply
breaking changes
bug
cannot-reproduce
dependencies
documentation
duplicate
electron-issue
enhancement
fix-available
good first issue
help wanted
invalid
javascript
need more information
need rebase
official-youtube-music-issue
plugin request
question
release
security
stale
Status: blocked
typo
wontfix
ytmd-issue
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: YTMD/youtube-music#296
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "Araxeus/chromecast"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implement and closes #289
This plugin connects to all nearby Chromecast devices and stream youtube music with video
Sync Options:
Features Tested by @playday3008 - who originally requested this plugin
Thanks for the addition! Did not test it with a real chromecast device yet, but looks promising! Left a few first comments - about the security issue reported by Snyk,
chromecast-api@0.3.4
introducesdns-packet@4.2.0
which has aRemote Memory Exposure
vulnerability, fixed indns-packet@5.2.4
. Until the chromecast package has an update for this, the version can be forced with a resolution"dns-packet": "5.2.4",
in package.json:1fc8f7ad7e/package.json (L101)
(note that it's not the same major version so worth manually testing that everything works correctly!)
@ -0,0 +86,4 @@
function transformURL(url) {
const videoId = url.match(/(?:http(?:s?):\/\/)?(?:www\.)?(?:music\.)?youtu(?:be\.com\/watch\?v=|\.be\/)([\w\-\_]*)/);
// videoId[1] should always be valid since regex should always be valid - rickroll video should never happen :)
return "https://youtube.com/watch?v=" + (videoId.length > 1 ? videoId[1] : "dQw4w9WgXcQ");
Nice Rickroll 🙃 Maybe worth a comment in code, I wondered why this hardcoded ID was there at first 😅
@ -1,18 +1,37 @@
const { ipcRenderer } = require("electron");
nit: it might not be necessary to define the 2 inner functions if they are a one-liner and only used once!
nit: it can be simplified into
nit: could also be the default case for the switch, to be defensive
I'm getting a
Error: Failed to serialize arguments
(song-controls.js:15:54
) when using the play/pause media key, is it expected?@ -13,7 +13,8 @@ module.exports = (win) => {
previous: () => pressKey(win, "k"),
next: () => pressKey(win, "j"),
playPause: () => win.webContents.send("playPause"),
Is it expected this one is removed?
@ -1,18 +1,37 @@
const { ipcRenderer } = require("electron");
done 👍🏼
@ -13,7 +13,8 @@ module.exports = (win) => {
previous: () => pressKey(win, "k"),
next: () => pressKey(win, "j"),
playPause: () => win.webContents.send("playPause"),
It actually has nothing to do with this pull - but the
like
function was written twice - why's that?e0cb132686/providers/song-controls.js (L28)
e0cb132686/providers/song-controls.js (L16)
I just assumed it was a mistake since the first one works - so I removed the second one
@ -1,18 +1,37 @@
const { ipcRenderer } = require("electron");
done 👍🏼
@ -1,18 +1,37 @@
const { ipcRenderer } = require("electron");
I agree that
play()
is unnecessary, butpause()
is called in 2 different places(I originally added
play()
only becausepause()
was there - but I removed it as requested)It happened because shortcut plugin call the method with
win.webContents
argument.I just fixed it by making
play, pause
directly part of song controlssorry about that
@ -0,0 +86,4 @@
function transformURL(url) {
const videoId = url.match(/(?:http(?:s?):\/\/)?(?:www\.)?(?:music\.)?youtu(?:be\.com\/watch\?v=|\.be\/)([\w\-\_]*)/);
// videoId[1] should always be valid since regex should always be valid - rickroll video should never happen :)
return "https://youtube.com/watch?v=" + (videoId.length > 1 ? videoId[1] : "dQw4w9WgXcQ");
There is a comment already 😅
I thought the module would update its version faster - and this method will be unneeded
but sadly it hasn't happened yet - the fix pr was merged but the npm version wasn't updated yet
(method should only be called when songInfo is updated which means the url regex is valid - which means you should never get rick-rolled 😝)
Tested with latest changes
Well, we still need device list with optional auto connection
This feature would make the app feature complete for me, sadly I cannot help by coding. If there is anything I can do to help to refactor this for the latest version, please let me know!
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.