|
13622 | 13622 | */ |
13623 | 13623 | class VideoOverlay { |
13624 | 13624 | sideEffects = new SideEffects() |
| 13625 | + /** @type {boolean} */ |
| 13626 | + userOptedIntoKahfPlayer = false |
13625 | 13627 |
|
13626 | 13628 | /** @type {string | null} */ |
13627 | 13629 | lastVideoId = null |
|
13776 | 13778 | * always remove everything first, to prevent any lingering state |
13777 | 13779 | */ |
13778 | 13780 | this.destroy(); |
| 13781 | + |
| 13782 | + /** |
| 13783 | + * Reset the opt-in flag for the new video |
| 13784 | + */ |
| 13785 | + this.userOptedIntoKahfPlayer = false; |
13779 | 13786 |
|
13780 | 13787 | /** |
13781 | 13788 | * When enabled, just show the small dax icon |
@@ -13870,13 +13877,17 @@ |
13870 | 13877 | /** |
13871 | 13878 | * To clean up, we need to stop the interval |
13872 | 13879 | * and then call .play() on the original element, if it's still connected |
| 13880 | + * Only resume video if user opted out, not if they opted into Kahf Player |
13873 | 13881 | */ |
13874 | 13882 | return () => { |
13875 | 13883 | clearInterval(int); |
13876 | 13884 |
|
13877 | | - const video = /** @type {HTMLVideoElement} */(document.querySelector(this.settings.selectors.videoElement)); |
13878 | | - if (video?.isConnected) { |
13879 | | - video.play(); |
| 13885 | + // Only resume video if user opted out, not if they opted into Kahf Player |
| 13886 | + if (!this.userOptedIntoKahfPlayer) { |
| 13887 | + const video = /** @type {HTMLVideoElement} */(document.querySelector(this.settings.selectors.videoElement)); |
| 13888 | + if (video?.isConnected) { |
| 13889 | + video.play(); |
| 13890 | + } |
13880 | 13891 | } |
13881 | 13892 | } |
13882 | 13893 | }); |
|
13893 | 13904 | * @param {VideoParams} params |
13894 | 13905 | */ |
13895 | 13906 | userOptIn (remember, params) { |
| 13907 | + // Mark that user opted into Kahf Player to prevent video from resuming |
| 13908 | + this.userOptedIntoKahfPlayer = true; |
| 13909 | + |
13896 | 13910 | /** @type {import("../duck-player.js").UserValues['privatePlayerMode']} */ |
13897 | 13911 | let privatePlayerMode = { alwaysAsk: {} }; |
13898 | 13912 | if (remember) { |
|
0 commit comments