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

[DRAFT] Demo: store the settings in the url hash #1349

Open
wants to merge 89 commits into
base: dev
Choose a base branch
from

Commits on Feb 20, 2024

  1. Move directories around

    peaBerberian committed Feb 20, 2024
    Configuration menu
    Copy the full SHA
    923fa25 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    fe5f68c View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    9b684af View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    b7b26bf View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    ec9b355 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    232a588 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    09f1d67 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    3517d09 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    8d3bd64 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    048564f View commit details
    Browse the repository at this point in the history
  11. [Proposal] Solution 1: PlaybackObserver is moved in src

    Root issue
    ----------
    
    While working on code refactoring for better taking into account the new
    potentially multithread nature of the RxPlayer code (with some files
    only running in a WebWorker environment and others only running in a
    main thread environment), we recently refactored our file hierarchy
    (#1365) to better reflect that new situation. The idea is to make
    RxPlayer developpers more aware of what code is intended to run where.
    
    In that work, we had a remaining issue concerning the
    `PlaybackObserver`.
    This is the part of the code that is monitoring and advertising playback
    conditions to the rest of the RxPlayer code. Most core RxPlayer modules
    rely on it, in both main thread and WebWorker environments.
    
    The root issue is that the `PlaybackObserver` is a class and thus cannot
    be easily transmitted in-between environments (as the main thread and
    WebWorker only exchanges between one another through `postMessage`
    calls, which follows some rules preventing from doing that).
    
    As such, and only on a multithreaded scenario, the RxPlayer is
    serializing in some way the constructed source PlaybackObserver in the
    main thread to reconstruct one (the `WorkerPlaybackObserver`) on the
    worker.
    
    Because a whole complex PlaybackObserver-compatible structure has to
    both be constructed in the main thread and in the worker (yet only the
    main thread can act as the "true" source one, because the media element
    can only be accessed in main thread), we were asking ourselves where
    should we put the common utils (required by both the main thread and
    worker) needed to construct one (like the `ObservationPosition` class
    and the `generateReadOnlyObserver` util).
    
    Solution 1
    ----------
    
    This is a first solution proposal, which moves the `PlaybackObserver`
    directory outside of the `main_thread` and `core` directories. Instead,
    its code is now directly in `src/playback_observer`.
    
    This solution takes inspiration from the `src/mse` directory, which also
    exports both:
    
      1. files intended to be imported when MSE API are present in the
         current environment (when in main thread or when in a WebWorker
         with the MSE-in-worker feature) and
    
      2. files intended to be imported in environments without MSE.
    
    For example the `src/mse/main_media_source_interface.ts` should __ONLY__
    be imported in environments with MSE capabilities. If you do not, you
    should import `src/mse/worker_media_source_interface.ts`.
    
    Likewise, I here added a
    `src/playback_observer/media_element_playback_observer.ts` file exporting
    a `MediaElementPlaybackObserver` structure (new name of the
    `PlaybackObserver`) which can only be imported in environements where the
    media element is available (so, only on main thread) and a
    `src/playback_observer/worker_playback_observer.ts` file which should only
    be imported in other environments.
    
    Doing this allows to easily share common utils, in a
    `src/playback_observer/utils` directory, without involving the rest of
    the RxPlayer code.
    
    Result
    ------
    
    I'm quite happy with the result, though I get it may seem weird to have
    a complex core frequently-running logic part directly in `src` (and not
    in `main_thread` or `core` as was the norm) - though it is also the case
    of directories like `mse` or `transports`.
    
    RxPlayer code very rarely imported files inside other directories (which
    it does here with paths like
    `../playback_observer/media_element_playback_observer`) as a way to
    push better modularization. Though here it may seem like a feature
    because its unusual-ness forces the developper to double check if this
    is the right file that is imported.
    peaBerberian committed Feb 20, 2024
    Configuration menu
    Copy the full SHA
    9d59746 View commit details
    Browse the repository at this point in the history
  12. Update FILES.md

    peaBerberian committed Feb 20, 2024
    Configuration menu
    Copy the full SHA
    1b11702 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    adfd991 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    e091b24 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    0e3847f View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    cce5d0d View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    45351b6 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    6a9bca9 View commit details
    Browse the repository at this point in the history
  19. Update .npmignore

    peaBerberian committed Feb 20, 2024
    Configuration menu
    Copy the full SHA
    b9136fc View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    ca61b54 View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    b6a0300 View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    66fc6fe View commit details
    Browse the repository at this point in the history
  23. refactor: create a fn getRetryDelay and test it

    maxDelay now restrict the value of the delay after that the fuzzFactor
    has been applied. This ensure that the returned delay is trully
    equal or inferior the the maxDelay.
    This would reduce from 3900ms to 3000ms the maxDefault based on our
    current config but updating the value does not seem necessary.
    Florent-Bouisset authored and peaBerberian committed Feb 20, 2024
    Configuration menu
    Copy the full SHA
    300ae2a View commit details
    Browse the repository at this point in the history
  24. Don't re-load a Manifest's optional external resource each time if in…

    …itial failed
    
    While doing some testing on `<UTCTiming>` elements in a DASH MPD, it has
    been brought to us that if attempts to load an URL linked to it for the
    initial fetch of the Manifest failed (in which case we fallback to a mode
    where we don't rely on that element) and if the Manifest has to be
    refreshed multiple times, then the URL will be accessed every time the
    Manifest is refreshed, even if just one sucessful attempt would be
    enough.
    
    The issue was very simple to fix, as it was just that a newly obtained
    `clockOffset` - the actual metadata derived from parsing an
    `<UTCTiming>` element, was just not actually copied when updating the
    base Manifest by its new parsed version.
    
    Once that `clockOffset` is set to the base Manifest, that information
    will be communicated to our Manifest parser when refreshed, so it won't
    retry to load the clock and continue relying on the one fetched before.
    peaBerberian committed Feb 20, 2024
    Configuration menu
    Copy the full SHA
    1bc73c0 View commit details
    Browse the repository at this point in the history
  25. update .gitignore

    peaBerberian committed Feb 20, 2024
    Configuration menu
    Copy the full SHA
    3707906 View commit details
    Browse the repository at this point in the history
  26. fix(test): fix flaky test by changing timeout according to the

    expected retryDelay
    Florent-Bouisset authored and peaBerberian committed Feb 20, 2024
    Configuration menu
    Copy the full SHA
    fe60ef2 View commit details
    Browse the repository at this point in the history
  27. Merge pull request #1370 from canalplus/fix/update-clock-offset

    Don't re-load a Manifest's optional external resource each time if initial failed
    peaBerberian committed Feb 20, 2024
    Configuration menu
    Copy the full SHA
    e6a2a99 View commit details
    Browse the repository at this point in the history
  28. Configuration menu
    Copy the full SHA
    e729d9a View commit details
    Browse the repository at this point in the history
  29. Configuration menu
    Copy the full SHA
    441f91b View commit details
    Browse the repository at this point in the history
  30. fix(types): remove IIFE to correctly export Player class type

    exporting a class with an IIFE change the exported type of the class
    from "RxPlayer" to "typeof RxPlayer". That will provoke typechecking
    errors for applications that used "RxPlayer" as a type.
    This does NOT mess-up with the sideEffects config because
    the global overrides, such as "patchWebkitSourceBuffer()" are executed
    at the entry point for RxPlayer class (src/index and src/minimal).
    Florent-Bouisset authored and peaBerberian committed Feb 20, 2024
    Configuration menu
    Copy the full SHA
    2632ab4 View commit details
    Browse the repository at this point in the history
  31. Merge pull request #1359 from canalplus/fix/flaky-test-get-license

    fix(test): fix flaky test get_license
    peaBerberian committed Feb 20, 2024
    Configuration menu
    Copy the full SHA
    8da7fb9 View commit details
    Browse the repository at this point in the history
  32. Configuration menu
    Copy the full SHA
    c1c605c View commit details
    Browse the repository at this point in the history
  33. Merge pull request #1376 from canalplus/fix/error-ts-iife

    fix(types): remove IIFE to correctly export Player class type
    peaBerberian committed Feb 20, 2024
    Configuration menu
    Copy the full SHA
    b8d11c9 View commit details
    Browse the repository at this point in the history
  34. fix circular dependencies issues.

    Commit 2744e33
    Reorganized the repo and introduce circular dependencies.
    Florent-Bouisset authored and peaBerberian committed Feb 20, 2024
    Configuration menu
    Copy the full SHA
    e28caad View commit details
    Browse the repository at this point in the history
  35. Merge pull request #1381 from canalplus/demo/fix-limit-video-res

    fix(demo): text for limit video resolution updates when selecting another options
    peaBerberian committed Feb 20, 2024
    Configuration menu
    Copy the full SHA
    0897199 View commit details
    Browse the repository at this point in the history
  36. Merge pull request #1383 from canalplus/fix/circular-dependencies-reorg

    fix circular dependencies issues.
    peaBerberian committed Feb 20, 2024
    Configuration menu
    Copy the full SHA
    6e9177f View commit details
    Browse the repository at this point in the history
  37. Configuration menu
    Copy the full SHA
    c7d9175 View commit details
    Browse the repository at this point in the history
  38. Configuration menu
    Copy the full SHA
    85a9856 View commit details
    Browse the repository at this point in the history
  39. Configuration menu
    Copy the full SHA
    552649d View commit details
    Browse the repository at this point in the history
  40. Configuration menu
    Copy the full SHA
    cc6a502 View commit details
    Browse the repository at this point in the history

Commits on Feb 21, 2024

  1. Configuration menu
    Copy the full SHA
    a40526f View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    5a5ed8f View commit details
    Browse the repository at this point in the history
  3. Merge pull request #1385 from canalplus/fix/canal-ps5-close-session

    fix: workaround for ps5 to prevent error when closing persistent session
    peaBerberian committed Feb 21, 2024
    Configuration menu
    Copy the full SHA
    8bf8876 View commit details
    Browse the repository at this point in the history

Commits on Feb 23, 2024

  1. [POC]: Experiment with "txml" parser, to get rid of the DOMParser

    Motivation
    ----------
    
    Currently, we relied on our WebAssembly MPD parser for two different
    scenarios:
    
      1. performance reasons (on **HUGE** MPD of tens of MB, with a lot of
         `SegmentTimeline` data to parse). Also Relying on WebAssembly here
         instead of DOM parsing led us to much less GC pressure which was also
         a big issue.
    
      2. Multithread scenarios as the browser's own fast XML parser, `DOMParser`,
         is not usable in other threads.
    
    Though that second scenario only relied on the WebAssembly parser
    because it was already written before (and it was because of the first
    scenario).
    Nothing stops us from relying on a JavaScript MPD parser in Multithread
    mode, we only cannot use `DOMParser` there.
    
    Having to provide the WebAssembly code to the `MULTI_THREAD` feature is
    a little awkward. We recommend to applications that they use our
    "embedded" versions to make it more simple, though it weighs in the 400+KB.
    Even if it compresses very very well, it is still a huge file.
    
    It also turn out that WebAssembly is much more recent than the WebWorker
    API and as such we're currently not able to rely on the Multithread
    mode on very old devices like old smart TV models and old game consoles.
    Even worse, an issue in the `v4.0.0-rc.1` made us realize that a device
    might be compatible to WebAssembly but might fail to compile it for
    various reasons, leading to a fallback to main thread - it would be
    better to have a fallback to a JS Parser, like we already have on main
    thread today.
    
    It may even make Multithread-only RxPlayer builds (e.g. not having to import
    both monothread code and multithread code, just in case multithreading is
    not possible) much more doable, which [I guess almost everyone could prefer
    for their applications](https://caniuse.com/webworkers).
    
    Thus, relying on a JavaScript parser in a Multithread scenario could be
    a very nice feature.
    
    Previous work
    -------------
    
    In a previous work (I never made the Pull Request for it yet), I
    compiled down the WebAssembly file to JavaScript (through binaryen's
    wasm2js util), but it involved a lot of manual maintainance so I quickly
    abandonned it (I may re-explore that way in the future). This could have
    been nice as it prevented adding yet another MPD parser to the
    codebase.
    
    I also made quick tests with dependencies like `fast-xml-parser` but
    performances appeared poor so I did not continue in this path.
    
    This solution
    -------------
    
    To be perfectly honest, it was only after looking at some Shaka-player
    code that I noticed that they now rely on a "txml" dependency for their
    XML parsing.
    It's actually very recent: shaka-project/shaka-player@7116a34
    (the recent-ness of it made me feel that I may be looking at their codebase a
    little too much ^^) and it seems to be on their side for performance
    reason - very interestingly.
    
    So I looked up that txml thing (repo available here: https://github.com/TobiasNickel/tXml/).
    It is a fairly minimal XML DOM parser with a specific focus on speed.
    It advertises speed competitive with the native DOMParser API and quite
    amazingly it actually was, sometimes it was even faster (though still slower
    than our WebAssembly parser).
    
    If this goes very well, we could even imagine doing like the
    Shaka-player and completely remove the DOMParser - even opening the way
    to also do things like parsing subtitles in a worker. For that, there is
    still a lot to do though.
    
    The code was a little hard to integrate through `npm` in a TypeScript
    client-side project (for various reasons) so I made the same choice than
    Shaka-player by completely copying its code (keeping the licence in the
    file) into `src/utils/xml-parser.ts`.
    
    I also had to update its code, this means that code updates on their
    side will have to be backported on ours.
    However, the code seems to not be much maintained anymore, so this is
    not that much of an issue.
    
    Remaining issues
    ----------------
    
    There are some remaining issues:
    
      - First I did not yet add parsing for `EventStream` elements nor for
        `SegmentTimeline` elements yet. Both seems doable, and the latter
        will be the real-world test (as it can be incredibly huge on some
        contents).
    
      - From what I understand from TobiasNickel/tXml#44,
        It doesn't translate entities (like `&gt;` to `>`). This doesn't seem to
        hard to implement though and is rarely important.
    
    Maybe others. There doesn't seem to be a lot of issues (but it doesn't
    seem to be a hugely-relied on project either) so I'll look at each of
    them in the future.
    peaBerberian committed Feb 23, 2024
    Configuration menu
    Copy the full SHA
    71a25e3 View commit details
    Browse the repository at this point in the history
  2. Parse xml entities

    peaBerberian committed Feb 23, 2024
    Configuration menu
    Copy the full SHA
    4579511 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    fe92987 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    dce924c View commit details
    Browse the repository at this point in the history
  5. DASH: rewrite unit tests

    peaBerberian committed Feb 23, 2024
    Configuration menu
    Copy the full SHA
    69c1d83 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    c849efb View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    89f2e1c View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    9238d1a View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    1707042 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    5e07364 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    66605c6 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    4bf4fc8 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    f3b92a1 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    b6c2166 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    fded006 View commit details
    Browse the repository at this point in the history
  16. Merge pull request #1384 from canalplus/feat/txml

    DASH: rely on "txml" parser for Multithreading usages
    peaBerberian committed Feb 23, 2024
    Configuration menu
    Copy the full SHA
    753400e View commit details
    Browse the repository at this point in the history
  17. Update nodejs version

    peaBerberian committed Feb 23, 2024
    Configuration menu
    Copy the full SHA
    0344cef View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    9cfe8d6 View commit details
    Browse the repository at this point in the history
  19. tests: perform exponential backoff in integration tests

    This is an implementation of an idea we had in the past to speed up
    asynchronous tests.
    
    Those often depend on some timeout, with a timeout set very high
    (hundreds of milliseconds, sometimes seconds) to ensure a test pass even
    on the slowest machine running up our tests.
    
    This results in our integration tests taking a lot of time to finish
    (more than 30 minutes), even more considering that those are not
    parallelized, unlike our unit tests (and doing so is not straightforward
    because we rely on a dependency, mocha, as a test runner and on another,
    karma, as a browser launcher).
    
    To make it less long, we wondered if we could not rely on another
    strategy:
      1. Perform the check almost immediately, on fast computers it has a
         chance of very quickly passing
      2. If the check fails, wait some amount of time and re-perform the
         check.
      3. If the check fails multiple times, it surely means that the current
         device is slow, so we'll wait a longer and longer delay before
         re-performing the check.
      4. If the check still fails after some set time (or 4 seconds by
         default), fail the test.
    
    This is basically another implementation of an "exponential backoff"
    algorithm in the player (we already use this type of algorithm at
    several places in the player, like for media requests for example).
    peaBerberian committed Feb 23, 2024
    Configuration menu
    Copy the full SHA
    60f1651 View commit details
    Browse the repository at this point in the history

Commits on Feb 26, 2024

  1. Configuration menu
    Copy the full SHA
    7211b73 View commit details
    Browse the repository at this point in the history

Commits on Feb 27, 2024

  1. Configuration menu
    Copy the full SHA
    df4b05f View commit details
    Browse the repository at this point in the history

Commits on Mar 4, 2024

  1. Merge pull request #1393 from canalplus/fix/directfile-autoplay-infin…

    …ite-spinner
    
    fix(directfile): media with autoplay:false is infinitly in loading state
    peaBerberian committed Mar 4, 2024
    Configuration menu
    Copy the full SHA
    17c131a View commit details
    Browse the repository at this point in the history
  2. Remove isSafariMobile mention from main_thread code.

    When doing some hotfixes for our v4.0.0 version, we directly integrated
    a browser detection check in the main code of the RxPlayer.
    
    The normal way for the RxPlayer of handling device compatibility, is to
    clearly list and document all differences in the `src/compat` directory,
    not directly in the main code.
    
    This commit fixes that by giving a name to that work-around, documentating it
    and moving it in the `src/compat` directory.
    peaBerberian committed Mar 4, 2024
    Configuration menu
    Copy the full SHA
    4f91e78 View commit details
    Browse the repository at this point in the history

Commits on Mar 5, 2024

  1. Configuration menu
    Copy the full SHA
    0a54469 View commit details
    Browse the repository at this point in the history

Commits on Mar 7, 2024

  1. Configuration menu
    Copy the full SHA
    e8a7671 View commit details
    Browse the repository at this point in the history
  2. Merge pull request #1395 from canalplus/misc/remove-is-safari-mobile-…

    …from-initial-seek-and-play
    
    Remove `isSafariMobile` mention from `main_thread` code.
    peaBerberian committed Mar 7, 2024
    Configuration menu
    Copy the full SHA
    70c50d5 View commit details
    Browse the repository at this point in the history

Commits on Mar 8, 2024

  1. Configuration menu
    Copy the full SHA
    026fb05 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c42c4b6 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    66e19b7 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    09aece7 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    f4aecea View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    bc4f508 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    7e176de View commit details
    Browse the repository at this point in the history
  8. fix prettier

    Florent-Bouisset committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    2e1d19e View commit details
    Browse the repository at this point in the history
  9. add jsdoc

    Florent-Bouisset committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    12636d6 View commit details
    Browse the repository at this point in the history
  10. MR feedback

    Florent-Bouisset committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    f64b702 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    c7765b6 View commit details
    Browse the repository at this point in the history
  12. some fixes

    Florent-Bouisset committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    2c8aca2 View commit details
    Browse the repository at this point in the history
  13. simplify code

    Florent-Bouisset committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    b2e92fb View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    bda1349 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    1f3c3d7 View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    6d176fb View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    ac519b0 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    e7685f2 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    1a7da65 View commit details
    Browse the repository at this point in the history

Commits on May 31, 2024

  1. lint

    Florent-Bouisset committed May 31, 2024
    Configuration menu
    Copy the full SHA
    c02bc4b View commit details
    Browse the repository at this point in the history