Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to unmute the audio #22

Closed
Jarda-H opened this issue May 8, 2023 · 11 comments
Closed

Option to unmute the audio #22

Jarda-H opened this issue May 8, 2023 · 11 comments

Comments

@Jarda-H
Copy link
Contributor

Jarda-H commented May 8, 2023

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

@styxpilled
Copy link
Contributor

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
Copy link
Contributor Author

Jarda-H commented May 11, 2023

@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
Copy link
Contributor

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
Copy link
Owner

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
Copy link
Contributor Author

Jarda-H commented May 11, 2023

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

@jirkavrba
Copy link
Owner

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
Copy link
Owner

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

@aetonsi
Copy link

aetonsi commented May 12, 2023

@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
Copy link
Contributor

@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
Copy link

aetonsi commented May 15, 2023

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
@jirkavrba @aetonsi @Jarda-H @styxpilled and others