Skip to content

Commit

Permalink
fix: sendEmptyAnnouncement
Browse files Browse the repository at this point in the history
  • Loading branch information
DimaDemchenko committed Nov 20, 2024
1 parent 9afbf7f commit 556a5f7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/p2p-media-loader-core/src/p2p/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,16 @@ export class P2PLoader {
};

broadcastAnnouncement = (sendEmptyAnnouncement = false) => {
if (this.isAnnounceMicrotaskCreated || this.config.isP2PUploadDisabled) {
if (sendEmptyAnnouncement) {
this.sendSegmentsAnnouncement([], []);
return;
}

const { loaded, httpLoading } = sendEmptyAnnouncement
? { loaded: [], httpLoading: [] }
: this.getSegmentsAnnouncement();
if (this.isAnnounceMicrotaskCreated || this.config.isP2PUploadDisabled) {
return;
}

const { loaded, httpLoading } = this.getSegmentsAnnouncement();
this.sendSegmentsAnnouncement(loaded, httpLoading);
};

Expand Down

0 comments on commit 556a5f7

Please sign in to comment.