Skip to content

Commit

Permalink
P2P loader. (#305)
Browse files Browse the repository at this point in the history
* Fix issue with wrong segment endTime.

* Fix issue with hls wrong segment local id.

* Add linked-map, load queue and http-loader.

* Add load queue class.

* Add segments storage.

* Add segments load logic.

* Add plugin requests promises map.

* Rewrite load queue.

* Move segment queue status determination to queue class.

* Separate main and secondary stream to different contexts.

* Remove unnecessary loader layer.

* Fix issue with not loading after moving playhead to random position.

* Rename hybrid loader file.

* Initialize playback on first segment request by plugin.

* Make storage async. Add core destroy logic.

* Use StreamWithReadonlySegments type in plugins.

* Add bandwidth approximator.

* Refactor load queue code.

* Load controlling: pure functions style. (#302)

* Refactor code, use functional style.

* Add shaka playback update handling.

* Set playback after first segment is requested.

* Remove unnecessary linked map methods.

* Use is loaded callback in queue generating function instead of segment storage instance.

* Install bittorrent-tracker and ripemd160 to core.

* Create type declaration for bittorrent tracker.

* Create P2PLoader and Peer classes.

* Move enums to separate file.

* Remove unused position core property.

* Create secondary hybrid loader only if necessary.

* Add force parameter to process queue hybrid loader method.

* Add sendCommand method to Peer.

* Add request type.

* Create and apply RequestContainer class.

* Rename settings time window properties.

* Add AbortError.

* Add streams map to hybrid loader.

* Add peer self segments map generation logic.

* Notify peers on segment loadings update.

* Fix types issues.

* Add peer events.

* Add downloadSegment method to p2p-loader. Use p2p request type in Peer class.

* Use request container in p2p-loader.

* Add receiving segment chunks logic.

* Reject promise with errors in peer class.

* Rewrite fetch segment with async await.

* Use object with booleans instead of set for segment queue statuses.

* Rename fetch segment function.

* Rename hybrid loader public method.

* Use engine callbacks instead of promise creation in core.

* Remove unnecessary getControlledPromise function from engines.

* Create hybrid loaders when necessary data is already set.

* Add progress to http loading.

* Add progress functionality to Peer class.

* Fix type issues.

* Use only callbacks instead of promise creation in hls engine.

* Add segment storage initialization.

* Add peer settings options.

* Move storage cleanup logic into storage class.

* Add p2p loaders container.

* Add p2p loaders destroy logic.

* Remove unnecessary toString on string variable.

* Don't use response.arrayBuffer() if getting data from stream.

* Change peer announcement type and corresponding logic.

* Use single PeerRequestError with different types instead of lot of Error classes.

* Change peer announcement type and corresponding logic.

* Remove memory request container counters.

* Remove unnecessary segmentsToDelete from memory segment storage.

* Fix issue with typo in "chunk"

* Add ability to subscribe to segments store update.

* Add stale p2p loader destroy timeout.

* Add request container http requests subscriptions.

* Add vite-plugin-node-polyfills to demo.

* Move utils to separate folder.

* Fix issues with abort looping, not handling requests in container.

* Force queue process if playback position was significantly changed.

* Add stream property to segment type.

* Fix issue with fetch result data wrong promise error handling.

* Fix issue with not clearing aborted engine request.

* Add random http loading.

* Change JsonSegmentAnnouncement type.

* Add loading through p2p to process queue.

* Change load method parameter to queue item.

* Add loggers to hybrid loader, p2p-manager.

* Add load probability to http random load.

* Show stat in Demo. Destroy p2p manager if there is no uploadable data.

* Refactor code related to stat components.

* Add loggers select to demo.

* And onPeerClose event to Peer class.

* Fix issue with wrong array buffer slicing. Modify choosing peer connection logic.

* Add peer logger. Use utf-8 string for peer ids instead of hashes.

* Remove ripemd160 package.

* Install node types. Patch bittorrent-tracker. Remove modules ignoring for browsers in bittorrent-tracker package.json.

* Sent ArrayBuffer to peer instead of Buffer. Use custom function to change string from utf-8 to hex.

* Add remain time predicting logic.

* Create universal bandwidth-approximator.

* Add bitrate adaptation logic.

* Rename p2p-loader logger.

* Use simple number variable instead of object creation.

* Modify uploading cancellation logic.

* Broadcast announcement not more than 1 time for macrotask.

* Generate user-friendly stream hash.

* Configure tsconfig module, target options.

* Change event handler name to onSegmentLoaded.

* Add core event handlers to shaka.

* Fix issues with shaka streams playback.

* Revise and refactor code.

* Move p2p files to separate p2p directory.

* Rename request container file and p2p loader and container files.

* Add request-container, storage loggers. Use queueMicrotask instead of setTimeout.

* Fix issue with skipping first segment in queue generation function.

* Add binary serialization functions.

* Remove bits file.

---------

Co-authored-by: Igor Zolotarenko <[email protected]>
Co-authored-by: Andriy Lysnevych <[email protected]>
  • Loading branch information
3 people authored Nov 2, 2023
1 parent 96c9882 commit 3b0b69a
Show file tree
Hide file tree
Showing 41 changed files with 4,094 additions and 601 deletions.
3 changes: 2 additions & 1 deletion p2p-media-loader-demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"@types/react-dom": "^18.2.4",
"@vitejs/plugin-react": "^4.0.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.1"
"eslint-plugin-react-refresh": "^0.4.1",
"vite-plugin-node-polyfills": "^0.14.1"
}
}
Loading

0 comments on commit 3b0b69a

Please sign in to comment.