jirkavrba / vscode-subway-surfers

The Industrial Revolution and its consequences have been a disaster for the human race.
https://marketplace.visualstudio.com/items?itemName=jirkavrba.subway-surfers
MIT License
300 stars 22 forks source link

Option to unmute the audio #22

Closed Jarda-H closed 1 year ago

Jarda-H commented 1 year ago

Am I deaf or is the video really muted? 💀 Plspls, add the option to listen to the amazing Subway Surfers tunes while coding 🥰

styxpilled commented 1 year ago

So from what I know, this issue and #26 are actually much more complicated than they look. I checked #23 and while the button doesn't even seem to work for me (the Mute || Unmute text is broken, but checking devtools the muted flag also doesn't get changed), but even if it did work (I manually removed the muted flag), it still wouldn't work. A4M works because it uses audio that uses the mp3 codec. If you look at the supported media formats in webviews, only wav, mp3, ogg and flac are supported. A lot of videos use AAC, which isn't on the list. Microsoft can't ship the AAC codec because of a licensing issue (source). Videos from Youtube || Invidious probably use Opus, but it also isn't supported for some reason. You can't include the codecs in the extension because of licensing (also it would be a massive pain in the ass if you even could get it to work). And Microsoft isn't supporting them anytime soon. So I don't think this will happen.

Jarda-H commented 1 year ago

@styxpilled I tried the mute/unmute in a web browser and it worked fine //What about converting the video to h.264/mp3 and host in somewhere

styxpilled commented 1 year ago

I tried the mute/unmute in a web browser and it worked fine

Because Chromium or whatever has the audio codecs. And VSCode does not have these codecs, as it clearly stated here. Just because something works in a web browser doesn't mean it will work in the VSC webview.

What about converting the video to h.264/mp3 and host in somewhere

So like, host a web server? That will cost you a pretty penny. You could download the file, then run ffmpeg and transcode the audio but that is quite a rabbithole that I don't think is worth it. Where will you get ffmpeg from? I don't know if you can access the one that VSC uses but it doesn't have the correct codecs anyway, you can try to bundle it with the extension but there's still the licensing issues, and all of this is a ton of effort that I don't know who has the time for for a joke project.

jirkavrba commented 1 year ago

Yes currently looking into the issue with playback without audio.

I don't feel like transcoding videos on an external server tbh so I think I will just remove the option to unmute and leave it as it was before?

Jarda-H commented 1 year ago

yes ig... tho we could probably find some free hosting for video with mp3 codec. Nevermind, I'll just use spotify

jirkavrba commented 1 year ago

I think that's beyond of the scope of this extension at this point. It would require figuring out legal issues with licensing as long as the videos are stored on my servers afaik.

jirkavrba commented 1 year ago

Here's a drop in replacement for you :heart: https://www.youtube.com/watch?v=L3SMytHheZY

aetonsi commented 1 year ago

@styxpilled just for the sake of discussion and sharing ideas.. what about if, instead of trying to play audio "through" vscode, one played it via a sub process? Like a command line, (cross-platform?) audio player? Possibly within an invisible terminal window, or even within vscode's terminal, it depends on how the audio player hooks into the OS audio capabilities. Also some shells/terminals/dunno already have support for playing some types of files. But this would work for local files.

For remote files/videos on "mainstream" platforms, i don't know, especially regarding licensing/copyright issues. One could download the audio track from some famous platform via some famous tool(s) to download from that platform, and then play that track, all with the CLI. But that wouldn't be legal ofc. But there are plenty of platforms for copyright free tracks... it all comes down to the licensing terms of each platform

styxpilled commented 1 year ago

@aetonsi I don't know why you couldn't legally download videos from, lets say, Youtube with youtube-dl and play them back. How is that different from watching them in your browser? It's just that the VSCode team can't include various audio codecs because of licensing issues, and so we can't easily play it back in the webview. You can use youtube-dl-exec to download the videos and optionally use ffmpeg to strip out the video to save space. Then use the Terminal API or child_process to spawn a process that can hook into the system audio codecs, but that is a ton of work. You could use something like node-speaker, audic or @richienb/vlc. But this is a ton of overhead for playing audio; maybe just open up Youtube or Spotify in a real browser? Playing audio is absolutely possible and legal. It's just such a pain in the ass in the current state of things that I don't see any point in doing this.

aetonsi commented 1 year ago

There are a lot of legal problems, even more than technical ones. YouTube TOS:

The following restrictions apply to your use of the Service. You are not allowed to:

  1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as expressly authorized by the Service; or (b) with prior written permission from YouTube and, if applicable, the respective rights holders;

AFAIK you can download and reuse freely only the CC-BY licensed videos.

The rest is under the Standard YouTube License so it's subject to whatever is in that license:

Rights granted As a creator, if you mark your uploads with the standard YouTube license, you effectively restrict your video from being edited or reused by anyone (except YouTube) without your permission.

Broadcasting privileges If you mark your video with the standard YouTube license, you grant all broadcasting rights exclusively to YouTube. In this case, no one else has the right to host, share, or reproduce the video without your permission.

Copyright protection Finally, videos marked with the standard YouTube license are subject to copyright protection, and the creator of the video has the right to take legal action against violators. It should be noted, however, that users may sometimes use copyright-protected content without the creator's approval if they operate under the legal doctrine of Fair Use.

I looked up all of this a few years ago, because i wanted to use YT videos in a website and app of mine.. it was pretty messy


On the technical side, would it be that complicated to spawn a terminal child process and reproduce audio there? I'm talking as a total ignorant on the matter, i've never touched vscode's APIs.. Also i found this: https://github.com/mps-youtube/yewtube that apparently does both the downloading and reproducing (via an invisible VLC or other player).