Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Video sound keeps playing when I go back to homepage #1342

Closed
barteksdl21 opened this issue Jun 8, 2022 · 5 comments
Closed

Video sound keeps playing when I go back to homepage #1342

barteksdl21 opened this issue Jun 8, 2022 · 5 comments
Labels
Bug Bug or required update after YouTube changes No entiendo🥺 Seems we didnt understand some part. (Not enough information or unclear wording? Or out of scope?) up-for-grabs (a github standard for inviting new contributors) - Welcome! ♥

Comments

@barteksdl21
Copy link

BUG: When I go back to homepage after or while watching a video, the sound of the video keeps playing in the background. Even if I've watched the video to the very end, it'll just play the sound from the beginning. There's no mini player in the corner or anything, it's just the sound, and I have to refresh if I wanna make it go away.

HOW: play a video and click on the YouTube logo. Doesn't always happen but VERY often for me.

EXPECTED (/preferred) behavior: I go to homepage and video stops playing.

Setup:

⚬ ImprovedTube Version: 3.935
⚬ Browser: Firefox 101.0; I also had this problem a few months ago on Chrome and it made me uninstall the extension
⚬ Settings: {"add_scroll_to_top":true,"always_show_progress_bar":false,"channel_default_tab":"/videos","channel_trailer_autoplay":false,"channel_videos_count":false,"comments":"normal","description":"normal","forced_play_video_from_the_beginning":true,"forced_theater_mode":true,"header_hide_right_buttons":false,"header_improve_logo":true,"header_position":"hover_on_video_page","hide_author_avatars":false,"hide_date":false,"hide_details":false,"hide_gradient_bottom":false,"hide_scroll_for_details":true,"hide_views_count":false,"hide_voice_search_button":true,"how_long_ago_the_video_was_uploaded":false,"likes":"normal","limit_page_width":true,"livechat":"collapsed","mark_watched_videos":true,"only_one_player_instance_playing":true,"player_autopause_when_switching_tabs":false,"player_autoplay":true,"player_crop_chapter_titles":false,"player_h264":true,"player_hide_cards":true,"player_hide_controls":false,"player_hide_endscreen":true,"player_loudness_normalization":false,"player_quality":"hd1080","player_remaining_duration":true,"player_size":"full_window","red_dislike_button":false,"related_videos":"normal","sidebar_left":false,"squared_user_images":false,"theme":"black","thumbnails_hide":false,"thumbnails_right":false,"track_watched_videos":true,"up_next_autoplay":false}
⚬ OS: Windows 11

@barteksdl21 barteksdl21 added Bug Bug or required update after YouTube changes help wanted Just an old github standard we add automatically. (The team can remove it when working on it.) labels Jun 8, 2022
@ghost
Copy link

ghost commented Jun 12, 2022

@chirag127 so switch over and stop spamming.

@hboyd2003
Copy link
Contributor

I have experienced this issue without the ImprovedTube Extension. I believe it is either the YouTube feature where it continues to play the video in a mini player in the bottom right hand corner or an issue with how loading works when you go back.

@barteksdl21 Is this issue still persisting and does it occur even when ImprovedTube is removed?

@hboyd2003 hboyd2003 added No entiendo🥺 Seems we didnt understand some part. (Not enough information or unclear wording? Or out of scope?) and removed help wanted Just an old github standard we add automatically. (The team can remove it when working on it.) labels Sep 29, 2022
@ImprovedTube
Copy link
Member

👋 @hboyd2003

@ImprovedTube
Copy link
Member

btw @barteksdl21 this seems to require:

"forced_play_video_from_the_beginning":true

? #1652

@ImprovedTube ImprovedTube added the up-for-grabs (a github standard for inviting new contributors) - Welcome! ♥ label Apr 29, 2023
@raszpl
Copy link
Contributor

raszpl commented Jun 17, 2024

"forced_play_video_from_the_beginning":true

forcedPlayVideoFromTheBeginning is using .seekTo(0)

ImprovedTube.forcedPlayVideoFromTheBeginning = function () {
if (this.storage.forced_play_video_from_the_beginning === true && document.documentElement.dataset.pageType === 'video' && !this.video_url.match(this.regex.video_time)?.[1]) {
this.elements.player.seekTo(0);
}
};

seekTo is YT player custom function with a side effect of starting to play automatically! Even if YT is hiding video in non active Video element this option when triggered will start playing = audio from invisible video.

Currently this bug doesnt happen anymore because one of those:

  • document.documentElement.dataset.pageType check was added later?
  • document.documentElement.dataset.pageType check was already there, but pageType wasnt being set quick enough. Similar problem autoplay quickfix  #1703 forced us to switch to location.href.includes('/watch?') in autoplayDisable()

Two fixes:

  • switch from this.elements.player.seekTo(0) to this.elements.video.currentTime = 0. Also rewinds, but with no side effects of triggering play() and less overhead EDIT: Didnt work. YT player actually reads currentTime and will hang while hammering currentTime(whatever) if it doesnt get what it wants :0. Back to seekTo(0) with optional check for paused.
  • abandon unreliable pageType

another related bug #1250 suggesting pageType check was added right then

@raszpl raszpl closed this as completed Jun 17, 2024
ImprovedTube added a commit that referenced this issue Jun 17, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Bug Bug or required update after YouTube changes No entiendo🥺 Seems we didnt understand some part. (Not enough information or unclear wording? Or out of scope?) up-for-grabs (a github standard for inviting new contributors) - Welcome! ♥
Projects
None yet
Development

No branches or pull requests

4 participants