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

Merged
merged 2 commits into from
Sep 18, 2024

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 peaBerberian force-pushed the misc/re-export-config branch from 5275acf to 86fc351 Compare August 20, 2024 15:12
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 peaBerberian force-pushed the misc/re-export-config branch from 86fc351 to 34323ec Compare August 23, 2024 21:08
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 peaBerberian force-pushed the misc/re-export-config branch from 34323ec to eb83db7 Compare August 23, 2024 21:12
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 peaBerberian force-pushed the misc/re-export-config branch from eb83db7 to 65260a2 Compare August 29, 2024 20:01
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?
@Florent-Bouisset
Copy link
Collaborator

Editing this configuration is only for debugging purposes, right ?
What I understand is that It's not intended for application developers to edit the configuration. Instead they should use the API to change the behavior rather than editing the config. For example, they should change loadVideo.requestConfig.timeout rather than changing DEFAULT_REQUEST_TIMEOUT.

So, if there is an option like LOAD_SEGMENTS_ONLY_IF_DECIPHERABLE that may provoke undesirable side effects,
and that applications developers are very likely to edit such an options, we should consider of making it part of a documented API ?

Apart from that I'm fine with the code

@peaBerberian
Copy link
Collaborator Author

What I understand is that It's not intended for application developers to edit the configuration. Instead they should use the API to change the behavior rather than editing the config. For example, they should change loadVideo.requestConfig.timeout rather than changing DEFAULT_REQUEST_TIMEOUT.

Yes

So, if there is an option like LOAD_SEGMENTS_ONLY_IF_DECIPHERABLE that may provoke undesirable side effects,
and that applications developers are very likely to edit such an options, we should consider of making it part of a documented API ?

I'm not sure I follow.

The idea here would be to open the way for config properties which are not intended to be in the API yet would be useful for debugging matters only.

If it turns out we have to add this to the API, we would be adding this to the API instead.

A third way which I'm experimenting in some PR right now is to have an experimental object in loadVideo / constructor for future API we're not yet sure whether they may be pertinent or not (e.g. experimental.enableResolutionChecks loadVideo option).

So:

  • config properties for things that are not in the API yet allows quick debugging. E.g. forcing all EME steps to start back from the beginning on a problematic device, pre-testing other ABR parameters in a particular scenario, asking a partner to retry reproducing an issue without multi-period support etc.

  • API properties only when we decide to add this as a configuration in the API. With the possibility to even bring experimental options for things we're not sure about yet

@Florent-Bouisset
Copy link
Collaborator

Ok, thanks for the explaination, got it!

@peaBerberian peaBerberian added this to the 4.2.0 milestone Sep 18, 2024
@peaBerberian peaBerberian merged commit 882e72d into dev Sep 18, 2024
6 checks passed
peaBerberian added a commit that referenced this pull request Nov 15, 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 Nov 15, 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 Nov 15, 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.).
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.

2 participants