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

[Proposal] Re-export config in v4 and synchronize main thread config and worker config #1510

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

Conversation

peaBerberian
Copy link
Collaborator

@peaBerberian peaBerberian commented Aug 20, 2024

In the RxPlayer team, we very often have to debug devices presenting some type of issue.

What we do usually is to create an RxPlayer branch (through git), push that branch to GitHub, then find a way (sometimes it's not so simple though) in the application in question to rely on the branch (we try to avoid pushing builds on GitHub, so we often rely on e.g. postinstall tricks to build the player in that application when installing / updating its dependencies).

Yet, having to dive into the application's CI / dependency system / build system is no fun and often breaks.

Diagnostics often follow similar RxPlayer code modifications, so I'm wondering if we could not bring back an idea we had in the v3 era:
The idea is to expose through an experimental export our global configuration, to allow updates of the RxPlayer config properties inside that application. Then we could add that custom logic inside the RxPlayer code and only enable it when a config property is enabled.

Config properties is not defined in the API, are comparable to globals (they don't need to be communicated at the function-level) and as such adding custom behavior based on config updates is relatively simple to do.

For example, for the now frequent need when debugging new devices of only loading segments once we now they are decipherable, we could just add in the target application (or even ask them to add temporarily):

import RxPlayerConfig from "rx-player/experimental/config";

RxPlayerConfig.update({
  LOAD_SEGMENTS_ONLY_IF_DECIPHERABLE: true,
})

Because in multithreading mode, we might have to synchronize the main thread's config to the worker's config, I also had to add some synchronization code. It is in essence the exact same problem than for our logger, so I kind of repeated the same logic here.

peaBerberian added a commit that referenced this pull request Aug 23, 2024
Based on #1510, the idea behind this proposal is to add to our config
properties allowing to force toggles we for now only enable for
specific devices.

The goal is to simplify the debugging of issues seen on specific devices
(which is the huge majority of them), by just having to update the
config in the corresponding application (as proposed by #1510).

So for example let's say that we encounter a new device where relying on
the same `MediaKeys` instance for multiple contents may fail after a
time (bug encountered on LG's WebOS, on some Panasonic TVs, and now, in
issue #1464, on Philips's TitanOS), we could just initially tell
application people to try setting that experimental flag.

If it fixes the issue, we will add a supplementary device check inside
the corresponding compat function.

This seems faster and less bothersome to me than having to create
special builds of the RxPlayer, and there our role could just be to
redirect the developer seeing the issue to the right config option
(as opposed to having to build a player, then link that player to the
application, making sure that their CI like us etc.).
peaBerberian added a commit that referenced this pull request Aug 23, 2024
Based on #1510, the idea behind this proposal is to add to our config
properties allowing to force toggles we for now only enable for
specific devices.

The goal is to simplify the debugging of issues seen on specific devices
(which is the huge majority of them), by just having to update the
config in the corresponding application (as proposed by #1510).

So for example let's say that we encounter a new device where relying on
the same `MediaKeys` instance for multiple contents may fail after a
time (bug encountered on LG's WebOS, on some Panasonic TVs, and now, in
issue #1464, on Philips's TitanOS), we could just initially tell
application people to try setting that experimental flag.

If it fixes the issue, we will add a supplementary device check inside
the corresponding compat function.

This seems faster and less bothersome to me than having to create
special builds of the RxPlayer, and there our role could just be to
redirect the developer seeing the issue to the right config option
(as opposed to having to build a player, then link that player to the
application, making sure that their CI like us etc.).
peaBerberian added a commit that referenced this pull request Aug 23, 2024
Based on #1510, the idea behind this proposal is to add to our config
properties allowing to force toggles we for now only enable for
specific devices.

The goal is to simplify the debugging of issues seen on specific devices
(which is the huge majority of them), by just having to update the
config in the corresponding application (as proposed by #1510).

So for example let's say that we encounter a new device where relying on
the same `MediaKeys` instance for multiple contents may fail after a
time (bug encountered on LG's WebOS, on some Panasonic TVs, and now, in
issue #1464, on Philips's TitanOS), we could just initially tell
application people to try setting that experimental flag.

If it fixes the issue, we will add a supplementary device check inside
the corresponding compat function.

This seems faster and less bothersome to me than having to create
special builds of the RxPlayer, and there our role could just be to
redirect the developer seeing the issue to the right config option
(as opposed to having to build a player, then link that player to the
application, making sure that their CI like us etc.).
peaBerberian added a commit that referenced this pull request Aug 23, 2024
Based on #1510, the idea behind this proposal is to add to our config
properties allowing to force toggles we for now only enable for
specific devices.

The goal is to simplify the debugging of issues seen on specific devices
(which is the huge majority of them), by just having to update the
config in the corresponding application (as proposed by #1510).

So for example let's say that we encounter a new device where relying on
the same `MediaKeys` instance for multiple contents may fail after a
time (bug encountered on LG's WebOS, on some Panasonic TVs, and now, in
issue #1464, on Philips's TitanOS), we could just initially tell
application people to try setting that experimental flag.

If it fixes the issue, we will add a supplementary device check inside
the corresponding compat function.

This seems faster and less bothersome to me than having to create
special builds of the RxPlayer, and there our role could just be to
redirect the developer seeing the issue to the right config option
(as opposed to having to build a player, then link that player to the
application, making sure that their CI like us etc.).
peaBerberian added a commit that referenced this pull request Aug 23, 2024
Based on #1510, the idea behind this proposal is to add to our config
properties allowing to force toggles we for now only enable for
specific devices.

The goal is to simplify the debugging of issues seen on specific devices
(which is the huge majority of them), by just having to update the
config in the corresponding application (as proposed by #1510).

So for example let's say that we encounter a new device where relying on
the same `MediaKeys` instance for multiple contents may fail after a
time (bug encountered on LG's WebOS, on some Panasonic TVs, and now, in
issue #1464, on Philips's TitanOS), we could just initially tell
application people to try setting that experimental flag.

If it fixes the issue, we will add a supplementary device check inside
the corresponding compat function.

This seems faster and less bothersome to me than having to create
special builds of the RxPlayer, and there our role could just be to
redirect the developer seeing the issue to the right config option
(as opposed to having to build a player, then link that player to the
application, making sure that their CI like us etc.).
peaBerberian added a commit that referenced this pull request Aug 23, 2024
Based on #1510, the idea behind this proposal is to add to our config
properties allowing to force toggles we for now only enable for
specific devices.

The goal is to simplify the debugging of issues seen on specific devices
(which is the huge majority of them), by just having to update the
config in the corresponding application (as proposed by #1510).

So for example let's say that we encounter a new device where relying on
the same `MediaKeys` instance for multiple contents may fail after a
time (bug encountered on LG's WebOS, on some Panasonic TVs, and now, in
issue #1464, on Philips's TitanOS), we could just initially tell
application people to try setting that experimental flag.

If it fixes the issue, we will add a supplementary device check inside
the corresponding compat function.

This seems faster and less bothersome to me than having to create
special builds of the RxPlayer, and there our role could just be to
redirect the developer seeing the issue to the right config option
(as opposed to having to build a player, then link that player to the
application, making sure that their CI like us etc.).
peaBerberian added a commit that referenced this pull request Aug 28, 2024
We've seen multiple occurences lately on several devices where playback
failed after playing a few encrypted contents.

On those, setting the `closesSessionsOnStop` option (an option and
already-existing work-around) had no effect, yet renewing the MediaKeys
at each load fixed the issue.

It's very probably a device bug. For those, we usually had the strategy
of knowing on which devices this problem was encountered, detect it
inside the RxPlayer, and choose to always renew the `MediaKeys` on those
(without the application even knowing we did that).

However, some users suggested to us to add this as an option, because
they may have reproduced the issue on other devices.

I'm kind of ambivalent toward adding this as an option:

  - I generally prefer our strategy of fixing it for all devices with the
    issue, with people reporting issues to us when a new device has the
    issue. This allows to fix it once and for all for all those devices.

  - I understand that some applications might prefer to iterate rapidly
    and be able to have more control over the RxPlayer behavior.

Another PR, #1510, would allow doing this by patching our config instead
but this would not be doable in production for applications (config
properties are not something we guarantee in our API).

This PR however, would allow applications to do it when and wherever they
please.

Thoughts?
peaBerberian added a commit that referenced this pull request Aug 28, 2024
We've seen multiple occurences lately on several devices where playback
failed after playing a few encrypted contents.

On those, setting the `closesSessionsOnStop` option (an option and
already-existing work-around) had no effect, yet renewing the MediaKeys
at each load fixed the issue.

It's very probably a device bug. For those, we usually had the strategy
of knowing on which devices this problem was encountered, detect it
inside the RxPlayer, and choose to always renew the `MediaKeys` on those
(without the application even knowing we did that).

However, some users suggested to us to add this as an option, because
they may have reproduced the issue on other devices.

I'm kind of ambivalent toward adding this as an option:

  - I generally prefer our strategy of fixing it for all devices with the
    issue, with people reporting issues to us when a new device has the
    issue. This allows to fix it once and for all for all those devices.

  - I understand that some applications might prefer to iterate rapidly
    and be able to have more control over the RxPlayer behavior.

Another PR, #1510, would allow doing this by patching our config instead
but this would not be doable in production for applications (config
properties are not something we guarantee in our API).

This PR however, would allow applications to do it when and wherever they
please.

Thoughts?
peaBerberian added a commit that referenced this pull request Aug 29, 2024
Based on #1510, the idea behind this proposal is to add to our config
properties allowing to force toggles we for now only enable for
specific devices.

The goal is to simplify the debugging of issues seen on specific devices
(which is the huge majority of them), by just having to update the
config in the corresponding application (as proposed by #1510).

So for example let's say that we encounter a new device where relying on
the same `MediaKeys` instance for multiple contents may fail after a
time (bug encountered on LG's WebOS, on some Panasonic TVs, and now, in
issue #1464, on Philips's TitanOS), we could just initially tell
application people to try setting that experimental flag.

If it fixes the issue, we will add a supplementary device check inside
the corresponding compat function.

This seems faster and less bothersome to me than having to create
special builds of the RxPlayer, and there our role could just be to
redirect the developer seeing the issue to the right config option
(as opposed to having to build a player, then link that player to the
application, making sure that their CI like us etc.).
@peaBerberian peaBerberian added proposal This Pull Request or Issue is only a proposal for a change with the expectation of a debate on it Priority: 2 (Medium) This issue or PR has a medium priority. labels Sep 3, 2024
peaBerberian added a commit that referenced this pull request Sep 4, 2024
Based on #1510, the idea behind this proposal is to add to our config
properties allowing to force toggles we for now only enable for
specific devices.

The goal is to simplify the debugging of issues seen on specific devices
(which is the huge majority of them), by just having to update the
config in the corresponding application (as proposed by #1510).

So for example let's say that we encounter a new device where relying on
the same `MediaKeys` instance for multiple contents may fail after a
time (bug encountered on LG's WebOS, on some Panasonic TVs, and now, in
issue #1464, on Philips's TitanOS), we could just initially tell
application people to try setting that experimental flag.

If it fixes the issue, we will add a supplementary device check inside
the corresponding compat function.

This seems faster and less bothersome to me than having to create
special builds of the RxPlayer, and there our role could just be to
redirect the developer seeing the issue to the right config option
(as opposed to having to build a player, then link that player to the
application, making sure that their CI like us etc.).
peaBerberian added a commit that referenced this pull request Sep 4, 2024
We've seen multiple occurences lately on several devices where playback
failed after playing a few encrypted contents.

On those, setting the `closesSessionsOnStop` option (an option and
already-existing work-around) had no effect, yet renewing the MediaKeys
at each load fixed the issue.

It's very probably a device bug. For those, we usually had the strategy
of knowing on which devices this problem was encountered, detect it
inside the RxPlayer, and choose to always renew the `MediaKeys` on those
(without the application even knowing we did that).

However, some users suggested to us to add this as an option, because
they may have reproduced the issue on other devices.

I'm kind of ambivalent toward adding this as an option:

  - I generally prefer our strategy of fixing it for all devices with the
    issue, with people reporting issues to us when a new device has the
    issue. This allows to fix it once and for all for all those devices.

  - I understand that some applications might prefer to iterate rapidly
    and be able to have more control over the RxPlayer behavior.

Another PR, #1510, would allow doing this by patching our config instead
but this would not be doable in production for applications (config
properties are not something we guarantee in our API).

This PR however, would allow applications to do it when and wherever they
please.

Thoughts?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: 2 (Medium) This issue or PR has a medium priority. proposal This Pull Request or Issue is only a proposal for a change with the expectation of a debate on it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant