code-charity / youtube

[top~1 open YouTube & Video browser-extension] - Enrich your experience & choice! 🧰180+ options & clever features 📌set+forget📌Longest-standing(been tough). Please join🧩us👨‍👩‍👧‍👧 ..⋮ {playback|content discovery|player|extra buttons|distractions|related videos|shorts|ads|quality|codec|full tab|full screen}
http://improvedtube.com
Other
3.54k stars 542 forks source link

Add button to play audio only (no video at all) for playing podcasts etc. #2286

Open tv21 opened 6 months ago

tv21 commented 6 months ago
SHORT Table (Summary)
Problem YouTube plays video even when playing something that is essentially audio only, wasting bandwidth.
Solution Have a button to play video only
Alternatives Download the video and play it in an external player (inconvenient)
Scope Hard to say; don't know how many users listen to podcasts or other predominately audio content
Side effects Other than having an additional button I can't think of any
Context The idea would be to prevent playing irrelevant video that wastes bandwidth / battery
error-404-usernotfound commented 6 months ago

This would be great, putting it in picture and picture giving it a basic audio playbar would be perfect for listening to music while I chat on Discord, ect.

ImprovedTube commented 6 months ago

hi! & thanks @tv21 @error-404-usernotfound

Our to-do list of buttons: #1445 :

we finished #300 recently


@error-404-usernotfound:

We can't reduce the size of pip but you can set the resolution to 144p, so hiding it might be possible to

Please try our mixer feature in version 3.* http://web.archive.org/web/20220531043659/https://addons.mozilla.org/firefox/downloads/file/3896635/youtube_addon-3.935.xpi, since we can fix it in the current version and add more to it


Let us know if anything else comes to mind sooner or later (Your input can be impactful and i'm not using every feature myself so exact implementations might rely on your voices. Whenever we implement something at all here, we can prepare conceptualize, design with extra depth to make best use of our time and volunteer developer's time and not add anything unnecessary or unsustainable.)

raszpl commented 6 months ago

Best we can do without some serious intrusion into YT internals is 'Quality without focus' to 144p and minimizing the tab.

Sadly it appears YT also swaps audio track for lower quality in that case, goes from 251 webm audio only 2 │ 31.29MiB 110k https │ audio only opus 110k 48k [en] medium, webm_dash to 250 webm audio only 2 │ 16.73MiB 59k https │ audio only opus 59k 48k [en] low, webm_dash and there is nothing we can do about it

ImprovedTube commented 6 months ago

serious

opt-in feature @raszpl

https://github.com/Ashish-Bansal/audio-only-youtube/blob/e9815328a39b0f3540e2d495599daf0a150030e4/src/js/background.ts#L75-L81

    const parametersToBeRemoved = ['range', 'rn', 'rbuf', 'ump'];
    const audioURL = this.removeURLParameters(url, parametersToBeRemoved);
    if (audioURL && this.tabIds.get(tabId) !== audioURL) {
      this.tabIds.set(tabId, audioURL);
      this.sendMessage(tabId);

YouTube video url paramters (these can help us to make some features in demand, such as buffer settings or to provide fallback methods for other features, to make them more failproof/futureproof)

parameter explanation a Value Value/s
rbuf Buffer size 1000 0, 10000
range Byte range 12345-67890 0-1048576
clen Content length 12345678 98765432
dur Duration 600 3600
quality Video quality hd720 medium, small
rn Random to avoid browser caching 123456
ump Performance metrics 1 0
itag Media format 140 (128kbps AAC) 18 (360p), 22 (720p HD), 137 (1080p), 5 (240p FLV), 17 (144p 3GP), 18 (360p MP4), 22 (720p MP4), 34 (360p FLV), 35 (480p FLV), 36 (240p 3GP), 37 (1080p MP4), 38 (3072p MP4), 43 (360p WebM), 44 (480p WebM), 45 (720p WebM), 46 (1080p WebM), 59 (480p MP4), 78 (480p MP4), 82 (360p MP4), 83 (480p MP4), 84 (720p MP4), 85 (1080p MP4), 91 (144p MP4), 92 (240p MP4), 93 (360p MP4), 94 (480p MP4), 95 (720p MP4), 96 (1080p MP4), 100 (360p WebM), 101 (480p WebM), 102 (720p WebM), 132 (240p MP4), 133 (360p MP4), 134 (480p MP4), 135 (720p MP4), 136 (1080p MP4), 137 (1080p MP4), 138 (2160p MP4), 139 (48kbps M4A), 140 (128kbps M4A), 141 (256kbps M4A)
mime MIME type video/mp4 audio/mp4, video/webm, audio/webm, video/mpeg audio/mpeg, video/ogg audio/ogg audio/wav audio/aac, video/x-flv video/3gpp video/x-matroska
ms Media source au (audio) va (video)
mv Media variant m u
mt Timestamp 1625097600 1625184000
lmt Last modified time 1609459200 1612137600
gir Segmenting yes no
pl Playlist index 1 2
t Timestamp (playback start) 1m30s 90s
id Video ID oHg5SJYRHA0
v Video ID dQw4w9WgXcQ
gcr Geo region IN CA
hl Language fr pt
cc_load_policy Closed captions 1 0
cc_lang_pref Preferred caption language cn kr
autoplay Autoplay 1 0
fs Fullscreen button 1 0
rel Related videos at end 1 0
modestbranding Modest Logo 1 0
raszpl commented 6 months ago

You cant manipulate most of those parameters, whole URLs are crypto signed and checksummed. As I said before doing what this extension does is VERY invasive. This one for example uses chrome.webRequest.onBeforeRequest.addListener to intercept already checksummed and crypto signed audio track URL in flight. Its the kind of thing Google bans extensions for (YT APIs Terms of Service) https://www.reddit.com/r/grayjay/comments/1ajv2ur/apparently_grayjay_got_a_cease_and_desist_letter/

ImprovedTube commented 5 months ago

hi @raszpl.

Cant

For example to set a minimum buffer size works well as a URL parameter. (It might helps people depending connection)

As said

The dystopian writing prompt, to be forced to use your eyes and ears at once. (+be disallowed to waste less bandwidth/electricity, let alone to keep memories)