Skip to content

Commit

Permalink
Откат обработчика события volumechange
Browse files Browse the repository at this point in the history
  • Loading branch information
SashaXser authored Jan 30, 2024
1 parent 81bc559 commit bc23a64
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 38 deletions.
2 changes: 1 addition & 1 deletion dist/vot-cloudflare-min.user.js

Large diffs are not rendered by default.

14 changes: 2 additions & 12 deletions dist/vot-cloudflare.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -5176,14 +5176,6 @@ class VideoHandler {
this.stopTranslation();
});

addExtraEventListener(this.video, "volumechange", () => {
debug/* default */.Z.log("lipsync mode is volumechange");
let videoVolume = this.getVideoVolume();
if (videoVolume !== this.data.autoVolume) {
this.volumeOnStart = videoVolume;
}
});

addExtraEventListener(this.video, "progress", async () => {
if (
!(this.firstPlay && this.data.autoTranslate === 1) ||
Expand Down Expand Up @@ -5406,10 +5398,6 @@ class VideoHandler {
return videoData;
}

if (!this.volumeOnStart) {
this.volumeOnStart = this.getVideoVolume();
}

if (window.location.hostname.includes("youtube.com")) {
this.ytData = await youtubeUtils.getVideoData();
videoData.isStream = this.ytData.isLive;
Expand Down Expand Up @@ -5728,6 +5716,7 @@ class VideoHandler {

youtubeUtils.videoSeek(this.video, 10); // 10 is the most successful number for streaming. With it, the audio is not so far behind the original

this.volumeOnStart = this.getVideoVolume();
if (typeof this.data.defaultVolume === "number") {
this.audio.volume = this.data.defaultVolume / 100;
}
Expand Down Expand Up @@ -5848,6 +5837,7 @@ class VideoHandler {
this.audio.src = proxiedAudioUrl;
}

this.volumeOnStart = this.getVideoVolume();
if (typeof this.data.defaultVolume === "number") {
this.audio.volume = this.data.defaultVolume / 100;
}
Expand Down
2 changes: 1 addition & 1 deletion dist/vot-min.user.js

Large diffs are not rendered by default.

14 changes: 2 additions & 12 deletions dist/vot.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -5165,14 +5165,6 @@ class VideoHandler {
this.stopTranslation();
});

addExtraEventListener(this.video, "volumechange", () => {
debug/* default */.Z.log("lipsync mode is volumechange");
let videoVolume = this.getVideoVolume();
if (videoVolume !== this.data.autoVolume) {
this.volumeOnStart = videoVolume;
}
});

addExtraEventListener(this.video, "progress", async () => {
if (
!(this.firstPlay && this.data.autoTranslate === 1) ||
Expand Down Expand Up @@ -5395,10 +5387,6 @@ class VideoHandler {
return videoData;
}

if (!this.volumeOnStart) {
this.volumeOnStart = this.getVideoVolume();
}

if (window.location.hostname.includes("youtube.com")) {
this.ytData = await youtubeUtils.getVideoData();
videoData.isStream = this.ytData.isLive;
Expand Down Expand Up @@ -5717,6 +5705,7 @@ class VideoHandler {

youtubeUtils.videoSeek(this.video, 10); // 10 is the most successful number for streaming. With it, the audio is not so far behind the original

this.volumeOnStart = this.getVideoVolume();
if (typeof this.data.defaultVolume === "number") {
this.audio.volume = this.data.defaultVolume / 100;
}
Expand Down Expand Up @@ -5827,6 +5816,7 @@ class VideoHandler {
false
) {}

this.volumeOnStart = this.getVideoVolume();
if (typeof this.data.defaultVolume === "number") {
this.audio.volume = this.data.defaultVolume / 100;
}
Expand Down
14 changes: 2 additions & 12 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1279,14 +1279,6 @@ class VideoHandler {
this.stopTranslation();
});

addExtraEventListener(this.video, "volumechange", () => {
debug.log("lipsync mode is volumechange");
let videoVolume = this.getVideoVolume();
if (videoVolume !== this.data.autoVolume) {
this.volumeOnStart = videoVolume;
}
});

addExtraEventListener(this.video, "progress", async () => {
if (
!(this.firstPlay && this.data.autoTranslate === 1) ||
Expand Down Expand Up @@ -1509,10 +1501,6 @@ class VideoHandler {
return videoData;
}

if (!this.volumeOnStart) {
this.volumeOnStart = this.getVideoVolume();
}

if (window.location.hostname.includes("youtube.com")) {
this.ytData = await youtubeUtils.getVideoData();
videoData.isStream = this.ytData.isLive;
Expand Down Expand Up @@ -1831,6 +1819,7 @@ class VideoHandler {

youtubeUtils.videoSeek(this.video, 10); // 10 is the most successful number for streaming. With it, the audio is not so far behind the original

this.volumeOnStart = this.getVideoVolume();
if (typeof this.data.defaultVolume === "number") {
this.audio.volume = this.data.defaultVolume / 100;
}
Expand Down Expand Up @@ -1951,6 +1940,7 @@ class VideoHandler {
this.audio.src = proxiedAudioUrl;
}

this.volumeOnStart = this.getVideoVolume();
if (typeof this.data.defaultVolume === "number") {
this.audio.volume = this.data.defaultVolume / 100;
}
Expand Down

0 comments on commit bc23a64

Please sign in to comment.