Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fix download auto-pausing when network is cut #177

Merged
merged 1 commit into from
Feb 1, 2022

Conversation

dero
Copy link
Collaborator

@dero dero commented Jan 19, 2022

Summary

The DownloadManager no longer has direct access to an associated videoDownloader instance after the changes requires to support the Background Fetch API.

We now use a custom event to signal a pause intent and when we're in a document context, we allow the VideoDownloaderRegistry instance to listen to these events and to direct them to the appropriate videoDownloader instances allowing them to change their UI to display a paused state.

Fixes #176

@dero dero self-assigned this Jan 19, 2022
@@ -226,7 +226,11 @@ export default class DownloadManager {
*/
forcePause() {
this.pause();
this.internal.videoDownloader.downloading = false;

if (document) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When is document falsy?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@beaufortfrancois In the service worker context, where DownloadManager is also used to interact with the Background Fetch API events.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed. Thanks!

@derekherman derekherman merged commit 9a352a1 into develop Feb 1, 2022
@derekherman derekherman deleted the fix/pause-downloads branch February 1, 2022 07:18
@felipebochehin87
Copy link

Bug found: #183

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Button "Resume download" is not displayed when internet connection is cut while downloading a video
4 participants