Skip to content

Pass arround MediaSourceClass to replace DummyMediaElement's hotfix#1777

Open
peaBerberian wants to merge 2 commits intodevfrom
misc/pass-MediaSourceClass
Open

Pass arround MediaSourceClass to replace DummyMediaElement's hotfix#1777
peaBerberian wants to merge 2 commits intodevfrom
misc/pass-MediaSourceClass

Conversation

@peaBerberian
Copy link
Copy Markdown
Collaborator

Back in our v4.4.0 we brought the DummyMediaElement feature allowing to run the RxPlayer's logic even on environments where actual decoding and/or decryption is not possible (incompatible codecs, DRMs, unavailable media API etc.).
Our main use case for this are testing purposes.

While wrapping up the release, we noted that we still relied on the actual MediaSource API for checking codec support, removing a key use case of the feature: testing the RxPlayer on a content even if the current env does not support any of its codec.

So we quickly implemented an exception in the corresponding code branch. It works and should catch all cases, but it was nonetheless not satisfactory for long-term maintainance.


To make it more explicit, I propose here to pass from the API to the Init the MediaSource class that should be used to play the content. In a DummyMediaElement's case, the MediaSource implementation linked to it will be provided instead of the favored MediaSource implementation found on the device.

A remaining issue is that as the class is not transmitted to core (as it is not serializable), core will still need to rely on the device's favored MediaSource implem. I thought that it wasn't an issue as a DummyMediaElement is not compatible for now with "MSE-in-worker" which is the only scenario where communicating its linked MediaSource would be needed.

@peaBerberian peaBerberian added this to the 4.5.0 milestone Jan 19, 2026
@peaBerberian peaBerberian force-pushed the dev branch 9 times, most recently from 0142e34 to 1fd9df3 Compare January 27, 2026 11:59
@peaBerberian peaBerberian force-pushed the misc/pass-MediaSourceClass branch from a246eec to 93ba098 Compare February 27, 2026 14:01
@github-actions
Copy link
Copy Markdown

✅ Automated performance checks have passed on commit 61f2d8e0a0d2764a91828e373082b5e1682ab6f6 with the base branch dev.

Details

Performance tests 1st run output

No significative change in performance for tests:

Name Mean Median
loading 25.56ms -> 25.98ms (-0.421ms, z: 0.85757) 36.30ms -> 36.45ms
seeking 336.40ms -> 340.42ms (-4.023ms, z: 1.03632) 17.40ms -> 17.25ms
audio-track-reload 32.53ms -> 32.54ms (-0.016ms, z: 0.09178) 48.60ms -> 48.65ms
cold loading multithread 52.21ms -> 52.01ms (0.200ms, z: 13.82686) 77.25ms -> 76.05ms
seeking multithread 52.04ms -> 48.00ms (4.045ms, z: 0.58345) 20.55ms -> 20.55ms
audio-track-reload multithread 30.91ms -> 30.77ms (0.136ms, z: 1.69706) 45.30ms -> 45.15ms
hot loading multithread 20.57ms -> 20.43ms (0.136ms, z: 3.92068) 30.30ms -> 30.00ms

@canalplus canalplus deleted a comment from github-actions Bot Feb 27, 2026
@peaBerberian peaBerberian added the Priority: 2 (Medium) This issue or PR has a medium priority. label Apr 2, 2026
@peaBerberian peaBerberian removed this from the 4.5.0 milestone Apr 9, 2026
Back in our `v4.4.0` we brought the `DummyMediaElement` feature allowing
to run the RxPlayer's logic even on environments where actual decoding
and/or decryption is not possible (incompatible codecs, DRMs, unavailable
media API etc.).
Our main use case for this are testing purposes.

While wrapping up the release, we noted that we still relied on the
actual `MediaSource` API for checking codec support, removing a key use
case of the feature: testing the RxPlayer on a content even if the
current env does not support any of its codec.

So we quickly implemented an exception in the corresponding code branch.
It works and should catch all cases, but it was nonetheless not
satisfactory for long-term maintainance.

---

To make it more explicit, I propose here to pass from the `API` to the
`Init` the `MediaSource` class that should be used to play the content.
In a `DummyMediaElement`'s case, the `MediaSource` implementation linked
to it will be provided instead of the favored `MediaSource`
implementation found on the device.

A remaining issue is that as the class is not transmitted to `core` (not
serializable), `core` will still need to rely on the device's favored
`MediaSource` implem. I thought that it wasn't an issue as a
`DummyMediaElement` is not compatible for now with "MSE-in-worker" which
is the only scenario where communicating its linked `MediaSource` would
be needed.
@peaBerberian peaBerberian force-pushed the misc/pass-MediaSourceClass branch from 93ba098 to a1dacdb Compare April 9, 2026 21:05
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 9, 2026

✅ Automated performance checks have passed on commit ca7ed1ec0bfaa14228f60f1e4afd15a4f84b730c with the base branch dev.

Details

Performance tests 1st run output

No significative change in performance for tests:

Name Mean Median
loading 24.85ms -> 25.67ms (-0.811ms, z: 1.53834) 35.25ms -> 35.55ms
seeking 230.42ms -> 251.05ms (-20.632ms, z: 0.14517) 18.15ms -> 17.85ms
audio-track-reload 32.44ms -> 32.40ms (0.045ms, z: 1.02276) 48.15ms -> 48.00ms
cold loading multithread 53.12ms -> 52.55ms (0.573ms, z: 8.10154) 77.70ms -> 76.65ms
seeking multithread 140.19ms -> 136.69ms (3.496ms, z: 0.45523) 20.25ms -> 20.25ms
audio-track-reload multithread 31.73ms -> 31.48ms (0.254ms, z: 2.36771) 46.50ms -> 46.20ms
hot loading multithread 21.28ms -> 21.22ms (0.067ms, z: 2.21354) 31.35ms -> 31.05ms

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant