Greasy Fork is available in English.

مۇنازىرىلەر » قۇرۇش تەلىپى

Change volume of gmail chat notification

§
يوللانغان ۋاقتى: 2024-03-26

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!!

§
يوللانغان ۋاقتى: 2024-03-27

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

§
يوللانغان ۋاقتى: 2024-03-27

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

§
يوللانغان ۋاقتى: 2024-03-28

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

§
يوللانغان ۋاقتى: 2024-03-28
تەھرىرلەنگەن ۋاقتى: 2024-03-28

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);
};
})();

§
يوللانغان ۋاقتى: 2024-03-28

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.

جاۋاب قايتۇرۇش

جاۋاب قايتۇرۇش ئۈچۈن كىرىش.