Closed maddyblue closed 1 week ago
I see this is doable with the ?play
param: https://chipplayerjs.app/?play=Nintendo%20SNES/Secret%20of%20Evermore/02%20Menu.spc
, but the current song is removed the the active URL.
So, I do not persist the play command in the URL for a few reasons...mostly, it conflicts with React Router and becomes stale. But I might be convinced if you feel strongly otherwise.
In the meantime, I changed the footer links to directly copy the song URL to clipboard to make this easier (1839f187b085396b804d7b23d3a689db7d02bdee). Please let me know if that seems like an improvement.
And I also added subtune linking (mostly for NSF/NSFE) in 7c7c8dc8d2d8d6f43daeea159a8967c12deff661.
Here is the comment I wrote about it (Browse.js):
PROBLEM:
When ?play=... is appended to URL, location.key becomes orphaned (undefined).
The React Router history object might need to be shimmed to make this param
completely transparent to browser navigation.
See https://stackoverflow.com/a/56823112/264970.
Consequences of trying to make ?play=... orthogonal to browse history:
browse/b
[click link]
browse/b/c
[play Song_X]
browse/b/c?play=Song_X
[scroll down]
[back]
browse/b
[next song]
browse/b?play=Song_Y (now location.key will be undefined)
[forward]
browse/b/c?play=Song_X (play param incorrectly reverts to Song_X)
using back and forward has always been problematic with the play param,
since it restores invalid URLs. Only now it breaks scroll restoration too.
...therefore, play param is now disabled.
Yes thanks this is great!
Totally understand about dealing with react router and history. I web-pilled myself after a decade of react and wanna go back to clicking and web browsers keep track of history on their own.
Being able to have URLs link directly to a song within a game would be great!