Discussies » Scriptaanvragen

Change volume of gmail chat notification

§
Geplaatst: 26-03-2024

When a new chat message arrives in the gmail chat it plays a sound at what seems like full volume. I've seen this mp3 downloaded in the network monitor
https://ssl.gstatic.com/chat/sounds/hub_chat_notification_sunrise-973b53e821dc8ec76587980d63d7d6c1.mp3
But I can't figure out how they are playing it. I don't see any tags in the page, don't seen any added dynamically. I've tried hooking Audio as well. I'm at a loss. Any idea how to fix this? Huge thanks in advance!!

§
Geplaatst: 27-03-2024

Probably JS. I kinda want to know as well how to control some played audio files volume.

You can use redirector extension and try and redirect this file address to your edited file with a less volume, host it anywhere

§
Geplaatst: 27-03-2024

But I guess it will stop working on first gmail update, when this hash part of the file will change

§
Geplaatst: 28-03-2024

When that page is loaded by itself, it is rendered as a video, so any HTML5 video API call works.

document.querySelector("video").play();
document.querySelector("video").pause();

document.querySelector("video").volume = 1; // 100% volume
document.querySelector("video").volume = 0.5; // 50% volume

§
Geplaatst: 28-03-2024
Bijgewerkt: 28-03-2024

I tried hooking play (which works in a test page i created), but it is never triggered by gmail's chat. Any ideas?

(function () {
log('hooking Audio.play');
// Save the original play method
const originalPlay = HTMLMediaElement.prototype.play;

// Override the play method
HTMLMediaElement.prototype.play = function() {
// Log when play is called
log('play method called'); // audio and video get here!

// Call the original play method
return originalPlay.apply(this, arguments);
};
})();

§
Geplaatst: 28-03-2024

I tried hooking play (which works in a test page i created), but it is never triggered by gmail's chat. Any ideas?

(function () {
log('hooking Audio.play');
// Save the original play method
const originalPlay = HTMLMediaElement.prototype.play;

// Override the play method
HTMLMediaElement.prototype.play = function() {
// Log when play is called
log('play method called'); // audio and video get here!

// Call the original play method
return originalPlay.apply(this, arguments);
};
})();

I have a custom log function in my script, so those log calls should be console.log here.

Reactie plaatsen

Log in om antwoord te geven.