Skip to content

Add new PlayerEvent::DurationChanged event#461

Merged
jdm merged 1 commit intoservo:mainfrom
tharkum:player-event-duration-changed
Nov 14, 2025
Merged

Add new PlayerEvent::DurationChanged event#461
jdm merged 1 commit intoservo:mainfrom
tharkum:player-event-duration-changed

Conversation

@tharkum
Copy link
Copy Markdown
Contributor

@tharkum tharkum commented Nov 14, 2025

The goal is to add a new event that allows the client to easily handle changes of the media stream's duration (sometimes duration could be imprecise or even identify with significant delay by media engine). Otherwise, the client must distinguish between consecutive MetadataUpdate events that differ only in the duration element, and handling them with different conditions (example HTMLMediaElement).

After this change will be the following
gstbin state - gstplay signal - event sequence:

  • new metadata -> media_info_updated -> MetadataUpdate event
  • new duration -> duration_changed + media_info_updated -> DurationChanged event + Nothing (already ignored)

Fixes (partially): servo/servo#40626

The goal is to add a new event that allows the client to easily
handle changes of the media stream's duration (sometimes duration
could be imprecise or even identify with significant delay by media
engine). Otherwise, the client must distinguish between consecutive
`MetadataUpdate` events that differ only in the `duration` element,
and handling them with different conditions (example HTMLMediaElement).

After this change will be  the following
`gstbin state - gstplay signal - event` sequence:
- new metadata  -> `media_info_updated` ->  `MetadataUpdate` event
- new duration -> `duration_changed` + `media_info_updated` ->
  `DurationChanged` event + Nothing (already ignored)

Fixes (partially): servo/servo#40626

Signed-off-by: Andrei Volykhin <[email protected]>
@tharkum tharkum force-pushed the player-event-duration-changed branch from 2568073 to 59ea0b6 Compare November 14, 2025 11:08
@tharkum
Copy link
Copy Markdown
Contributor Author

tharkum commented Nov 14, 2025

@jdm, @sdroege < Please take a look...

Copy link
Copy Markdown
Member

@jdm jdm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense!

@jdm jdm added this pull request to the merge queue Nov 14, 2025
Merged via the queue into servo:main with commit 1beaae4 Nov 14, 2025
3 checks passed
@tharkum tharkum deleted the player-event-duration-changed branch November 14, 2025 13:08
tharkum added a commit to tharkum/servo that referenced this pull request Nov 14, 2025
A new event `PlayerEvent::DurationChanged` has been added to
the media engine to simplify handling changes in the duration
of a media stream (sometimes the duration could be inaccurate
or even determined by the media engine with significant delay
after the initial metadata was ready).

This new event eliminates the need to check conditions for
two consecutive `MetadataUpdated` events (the initial metadata
and the metadata with the changed duration) during the loading
phase.

servo-media:
- Add new `PlayerEvent::DurationChanged` event (servo/media#461)

Testing: No expected changes in test results

Fixes: #servo#40626

Signed-off-by: Andrei Volykhin <[email protected]>
tharkum added a commit to tharkum/servo that referenced this pull request Nov 14, 2025
A new event `PlayerEvent::DurationChanged` has been added to
the media engine to simplify handling changes in the duration
of a media stream (sometimes the duration could be inaccurate
or even determined by the media engine with significant delay
after the initial metadata was ready).

This new event eliminates the need to check conditions for
two consecutive `MetadataUpdated` events (the initial metadata
and the metadata with the changed duration) during the loading
phase.

servo-media:
- Add new `PlayerEvent::DurationChanged` event (servo/media#461)

Testing: No expected changes in test results

Fixes: #servo#40626

Signed-off-by: Andrei Volykhin <[email protected]>
github-merge-queue bot pushed a commit to servo/servo that referenced this pull request Nov 14, 2025
A new event `PlayerEvent::DurationChanged` has been added to the media
engine to simplify handling changes in the duration of a media stream
(sometimes the duration could be inaccurate or even determined by the
media engine with significant delay after the initial metadata was
ready).

This new event eliminates the need to check conditions for two
consecutive `MetadataUpdated` events (the initial metadata and the
metadata with the changed duration) during the loading phase.

servo-media:
- Add new `PlayerEvent::DurationChanged` event
(servo/media#461)

Testing: No expected changes in test results

Fixes: #40626

Signed-off-by: Andrei Volykhin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants