Skip to content

Commit

Permalink
Implement mocked content playback on DummyMediaElement
Browse files Browse the repository at this point in the history
This is based on #1478.

On #1478, I was mocking MSE+EME + a part of the [HTML5 media
spec](https://html.spec.whatwg.org/#media-elements) to allow advanced
integration tests without having to create encrypted contents nor
having to physically test on all encountered environments.

The subset of the MSE and EME API that we use isn't very complex, the
harder part was to mock an `HTMLMediaElement`: especially the evolution
of the current position, rebuffering, ending, readyState, autoplay etc.

A shortcut I consequently took in #1478 was to rely on a potential
browser behavior: [the allowed to play](https://html.spec.whatwg.org/#allowed-to-play)
concept.
By forbidding playback through this mechanism, I could avoid all those
complex features while still being spec-compliant.

However forbidding playback prevent us from making a lot of useful
tests: e.g. on freezing, rebuffering, ending, auto-play etc.

So this commit is an attempt to implement that. I relied on the WHATWG
HTML spec but I took many shortcuts, especially by removing parts that
aren't relied on at all by the RxPlayer.

It's possible that I missed some quirks or that it still has some bugs,
but it right now seems to following the behavior of a real
`HTMLMediaElement` well enough.

I also did not implement "directfile" playback for now. For all those
missing features, we may ideally throw or indicate in some way that this
is not yet implemented.
  • Loading branch information
peaBerberian committed Dec 27, 2024
1 parent 23de2ca commit 052903a
Show file tree
Hide file tree
Showing 2 changed files with 900 additions and 197 deletions.
Loading

0 comments on commit 052903a

Please sign in to comment.