Skip to content

[PB-5816]: refactor/video streaming#1865

Open
xabg2 wants to merge 8 commits intomasterfrom
fix/browser-crashes-in-large-items-upload
Open

[PB-5816]: refactor/video streaming#1865
xabg2 wants to merge 8 commits intomasterfrom
fix/browser-crashes-in-large-items-upload

Conversation

@xabg2
Copy link
Contributor

@xabg2 xabg2 commented Feb 23, 2026

Description

Refactored the video streaming architecture to scope the Service Worker under video-stream, isolating streaming traffic and simplifying client communication.

The updated flow works as follows:

  • The Service Worker is now registered under the video-stream scope, meaning it only intercepts network requests within that path. This ensures streaming logic is fully isolated from the rest of the application.

  • Introduced a dedicated player.html file that embeds the

  • The client-side video streaming service/session logic has been refactored and simplified. It now communicates directly with the embedded HTML player.

Related Issues

Related Pull Requests

Checklist

  • Changes have been tested locally.
  • Unit tests have been written or updated as necessary.
  • The code adheres to the repository's coding standards.
  • Relevant documentation has been added or updated.
  • No new warnings or errors have been introduced.
  • SonarCloud issues have been reviewed and addressed.
  • QA Passed

Testing Process

Additional Notes

@xabg2 xabg2 self-assigned this Feb 23, 2026
@xabg2 xabg2 added the enhancement New feature or request label Feb 23, 2026
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 23, 2026

Deploying drive-web with  Cloudflare Pages  Cloudflare Pages

Latest commit: 381ac3e
Status: ✅  Deploy successful!
Preview URL: https://6ff7542f.drive-web.pages.dev
Branch Preview URL: https://fix-browser-crashes-in-large.drive-web.pages.dev

View logs

@xabg2 xabg2 marked this pull request as ready for review February 23, 2026 10:26

const session = new VideoStreamingSession({
fileId: file.fileId,
fileId: file.fileId ?? '',
Copy link
Contributor

Choose a reason for hiding this comment

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

If fileId is nullish or empty, then it means it is an empty file so it cannot be played. Maybe its a good idea to disable the preview when that happens or just throw an error if this code is not really reachable
wdyt? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, we can do that. I just leave it as it is because the flow will throw an error when trying to download the requested chunk, but yeah, let's throw an early error.

if (this.iframe) {
this.iframe.remove();
this.iframe = null;
this.sendToIframe('DESTROY', {});
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe this will never do anything because the iframe is null and the condition will never be satisfied

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep. We should to emit the event before removing the iframe and updating the reference to null

Comment on lines 42 to 43
resolve();
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

without a return after the resolve the function will continue executing and add second iframe


video.addEventListener('error', handleError);
video.addEventListener('canplay', handleCanPlay);
video.addEventListener('error', (error) => handleOnError(error.message));
Copy link
Collaborator

Choose a reason for hiding this comment

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

the removeEventListener will not work because it uses a different anonymous function.
removeEventListener compares by reference, so the arrow function of add and remove are two different objects in memory

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed. IT has been updated.

@xabg2 xabg2 requested review from CandelR and larryrider February 24, 2026 16:18
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants