w3c / webvtt

WebVTT Standard
https://w3c.github.io/webvtt/
Other
104 stars 40 forks source link

Proper conventions when converting to XML #366

Closed AliceWonderMiscreations closed 6 years ago

AliceWonderMiscreations commented 7 years ago

If there is a user list for this, please inform me. I looked for one and feel a user e-mail list would be better for this, but I did not find one. Due to autism I do not always do well in real time communication so irc isn't something I like to use.

-=-

There is a live demo for what I am doing but some of the content is not suitable for all audiences and I do not feel comfortable linking to it on this kind of a resource.

Anyway, I'm creating an html5 jukebox player for audio that supports captions, subtitles, and chapters.

For captions/subtitles I am taking the WebVTT cue strings and converting them to valid HTML5 but that creates some inconsistencies as far as CSS is concerned.

For example I turn [lt]v The Amazing Spiderman[gt]some stuff[lt]/v[gt] into [lt]span data-voice="The Amazing Spiderman"[gt]some stuff[lt]/span[gt]

That changes the CSS pseudo-selectors needed to stylize what Peter Parker says.

Is that still considered valid thing to do when rendering a WebVTT string or do I need to find another way?

Second thing, my understanding is the WebVTT allows some HTML entitles that are not allowed in XML and I'm an XML junkie that serves my content as application/xhtml+xml and so any WebVTT strings that include entitles have to be converted to what XML accepts.

Is the list of entities identical to HTML or are there additions? Also I have seen some WebVTT files in the wild that use U+nnnn - is that valid? e.g. do I need to look for those and convert them to [amp]#x; style entities or can I ignore them?

Thank you for suggestions.

AliceWonderMiscreations commented 7 years ago

Changing the v and c into spans I suppose is only a conformance issue with embedded STYLE which I currently ignore and may violate CSP if I did try to embed it, so when I stop ignoring embedded STYLE I will likely have to parse the CSS to apply with jQuery, and can translate the selectors when parsing it (thinking outloud here)

dwsinger commented 7 years ago

Hi Alice. re: "If there is a user list for this, please inform me." -- The VTT community group is probably the best place for email and other conversations https://www.w3.org/community/texttracks/

silviapfeiffer commented 6 years ago

@AliceWonderMiscreations Would you mind explaining what you're trying to achieve first? I'm finding it difficult to follow. Are you authoring WebVTT files and then interpreting them in HTML? Or are you trying to use a browser implementation of WebVTT for the rendering?

For example I turn [lt]v The Amazing Spiderman[gt]some stuff[lt]/v[gt] into [lt]span data-voice="The Amazing Spiderman"[gt]some stuff[lt]/span[gt]

That seems fine.

That changes the CSS pseudo-selectors needed to stylize what Peter Parker says.

Yes, your CSS selectors are different in WebVTT from HTML - I'm not quite sure how that is a problem?

About WebVTT entities: they refer to HTML entities, so no, there's no surplus ones in WebVTT. U+nnnn characters are valid in HTML also.

I can't see any change requests for the spec here, so will close this just as a comment.