rx-player icon indicating copy to clipboard operation
rx-player copied to clipboard

Remove RxJS from the SegmentBuffer and related code

Open peaBerberian opened this issue 2 years ago • 0 comments

This is yet another PR to remove RxJS from parts of the code to raise the RxPlayer's "approachability", after #962 (for the transports code), #1042 (the content decryption code) and #1091 (from the adaptive code).

This time, this is the turn of a relatively smaller part of the code: the "SegmentBuffers (in src/core/segment_buffers) which is the code wrapping browser's buffers (or even implementing them in the case of subtitles and image buffers).

Like the other PR before it, this one makes heavy usage of:

  • ISharedReference objects, which are very similar to RXJS BehaviorSubjects (always-set Observable values which are not lazy and can be getted at any time) to easily share values between blocks while allowing to trigger a callback when its inner state changes.
  • TaskCanceller and CancellationSignal, which are very similar to respectively the AbortController and AbortSignal APIs and which allows to easily and explicitly (generally unlike RxJS Observables where it often happens as a side-effect of unsubscription) abort cancellable asynchronous operations.

peaBerberian avatar Jun 13 '22 14:06 peaBerberian