w3c / sync-media-pub

Repository of the Synchronized Multimedia for Publications Community Group
http://w3c.github.io/sync-media-pub
Other
16 stars 4 forks source link

Possible to use pseudoclasses for synchronized highlight ? #8

Closed marisademeglio closed 4 years ago

marisademeglio commented 5 years ago

Need to evaluate the applicability of the :current CSS pseudo class from CSS Selectors 4 (see https://www.w3.org/TR/selectors-4/#the-current-pseudo ). The :past and :future counterparts would provide additional semantics.

marisademeglio commented 4 years ago

@danielweck I liked this idea of yours, any idea how feasible it would be to implement? I'm not so familiar with how to programmatically control pseudoclasses (you know, until the browser vendors want to natively implement this ;)

danielweck commented 4 years ago

CSS Selectors Level 4:

https://www.w3.org/TR/selectors-4/#time-pseudos

W3C Working Draft, 21 November 2018

https://drafts.csswg.org/selectors-4/#time-pseudos

Editor’s Draft, 17 August 2019

https://css4-selectors.com/selector/css4/time-dimensional-pseudo-class/

Key statement from the draft specification:

These pseudo-classes classify elements with respect to the currently-displayed or active position in some timeline, such as during speech rendering of a document, or during the display of a video using WebVTT to render subtitles. CSS does not define this timeline; the host language must do so. If there is no timeline defined for an element, these pseudo-classes must not match the element.

I will venture a guess and say that the chances of seeing consistent implementations of this proposed CSS feature in multiple web browsers within a reasonable timeframe ... are slim. To be precise, I am concerned that the host context of such CSS feature (e.g. HTML, or other technologies that embed / make use of CSS) would need to consistently implement time-domain semantics, whilst at the same time somehow exposing a mechanism for "sync media" to plug into in order to render its own synchronized highlights.

danielweck commented 4 years ago

So in response to:

Need to evaluate the applicability ...

...I would say: let's skip this for now, the specification is far from mature, let alone usable implementations.

marisademeglio commented 4 years ago

Ok, sounds good to me. We can start a document for future improvements and things to watch.

danielweck commented 4 years ago

PS: possible alternative to "time dimensional" => "highlight" pseudo-classes:

https://drafts.csswg.org/css-pseudo-4/#highlight-pseudos https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/master/highlight/explainer.md

Just like "time dimensional", this is probably a long shot until implementations, but I suspect consistent web browser support will be delivered sooner, because:

1) the need for "highlighting" techniques (decorations) that do not alter the DOM is very high (e.g. Range-based content annotations), 2) because there are no time-domain intricacies to deal with. As the "time dimensional" draft spec. says: CSS does not define this timeline; the host language must do so ... which is quite an open-ended proposition. In the sync-media case, if the "host language" is HTML, I'm not sure how the sync-media processor would hook into the web browser architecture to implement its timeline engine / to define current and previous-next playback state (e.g. installed browser plugin, Javascript authored and embedded into "web publications"?)

danielweck commented 4 years ago

Related issues: https://github.com/w3c/sync-media-pub/issues/21 https://github.com/w3c/sync-media-pub/issues/23

marisademeglio commented 4 years ago

We're in communication - we may be a good use case for the highlight api: https://github.com/w3c/csswg-drafts/issues/4307