Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduction of support to TTML #15

Draft
wants to merge 464 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
464 commits
Select commit Hold shift + click to select a range
58c1d3e
Improved loop with continue
alexandercerutti Jan 7, 2024
1e57775
Fixed parseCue creation of useless cueNodes by checking if they are e…
alexandercerutti Jan 7, 2024
437cd96
Removed offset and length from entities, entity leafability, refactor…
alexandercerutti Jan 7, 2024
9951ee1
Changed tests for IntervalBinaryTree
alexandercerutti Jan 7, 2024
940da4c
Removed offset and length from entities specs
alexandercerutti Jan 8, 2024
ff960ed
Decoupled styles from Entities' TagType
alexandercerutti Jan 9, 2024
68bef33
Splitted Style Entities from Tag Entities
alexandercerutti Jan 10, 2024
5af77ae
Set Webvtt adapter to generate style entities for global, id instead …
alexandercerutti Jan 10, 2024
e261a52
Removed attribute style from Tag Entity and fixed tests
alexandercerutti Jan 10, 2024
8093eed
Removed GenericEntity, converted tag and style entities to functions …
alexandercerutti Jan 10, 2024
7ca4d76
Fixed tests with new functions for entities
alexandercerutti Jan 10, 2024
ed0f007
Refactored entitiesToDOM to support style entities
alexandercerutti Jan 11, 2024
3c81a4e
Changed getSubtreeFromCueNodes to render same styles also on new line…
alexandercerutti Jan 12, 2024
24a8014
Improved type notation for commitDOMTree
alexandercerutti Jan 13, 2024
5882c92
Changed Entities test
alexandercerutti Jan 13, 2024
c8ceeb5
Added readonly modifies to StyleEntity
alexandercerutti Jan 13, 2024
8442143
Improved Playwright test through RendererFixture
alexandercerutti Jan 21, 2024
021c50b
Moved playwright test navigation to RendererFixture
alexandercerutti Jan 21, 2024
035051f
Added new test to check for text color
alexandercerutti Jan 21, 2024
9ed29d9
Removed Voice and Lang tags as a shared supported tag and changed it …
alexandercerutti Jan 21, 2024
ae1db97
Added Webvtt tag entities override to match with styles but send cue …
alexandercerutti Jan 21, 2024
21dcf96
Fixed more parsing tests
alexandercerutti Jan 21, 2024
bfb4b14
Removed satisfies for TS 5.x as not yet upgraded
alexandercerutti Jan 21, 2024
312ed46
Fixed more parser tests after changes
alexandercerutti Jan 22, 2024
e72d0a3
Merge branch 'feature/entities-rework' into feature/ttml-adapter
alexandercerutti Feb 10, 2024
31af1ac
Improve timeContext proxy comments and names and added comment for Sc…
alexandercerutti Jan 28, 2024
4c62953
Fixed scope test execution, which was creating another scope in the c…
alexandercerutti Jan 28, 2024
4f3ac58
Changed to package-lock
alexandercerutti Jan 28, 2024
7e01ca8
Changed sample to accept ttml tracks
alexandercerutti Jan 28, 2024
4fc3001
Upgraded Vite@^5
alexandercerutti Jan 28, 2024
22934e0
Set parseCueContents to accept all attributes instead of just regionId
alexandercerutti Jan 28, 2024
dd0faf7
Changed createStyleContext and createStyleParser to not accept anymor…
alexandercerutti Jan 29, 2024
82570ea
Removed token integration in RegionContext and regionParser
alexandercerutti Jan 29, 2024
7bc6668
Added support for origin and extent in TTMLRegion
alexandercerutti Feb 4, 2024
7505d38
Merge branch 'develop' into feature/ttml-adapter
alexandercerutti Feb 17, 2024
0d09374
Changed links to local packages through pnpm
alexandercerutti Feb 17, 2024
96f4112
Fixed test for which API changed
alexandercerutti Feb 17, 2024
b5cf552
Fixed how scope contexts are merged and how merging happens on style …
alexandercerutti Feb 18, 2024
8f2cb80
Added check over context optionality
alexandercerutti Feb 18, 2024
02e3d2b
Changed comment about region xml:id conflict in the document
alexandercerutti Feb 25, 2024
0eeaf43
Set scopes to require contexts to be context builders instead (provid…
alexandercerutti Mar 3, 2024
f6c0584
Added new DocumentContext to contain document tt attributes
alexandercerutti Mar 3, 2024
4275332
Set document attributes in parseCue to come from scope
alexandercerutti Mar 3, 2024
83595d3
Added support to new document attributes and added a new interface Do…
alexandercerutti Mar 3, 2024
7e2cd5e
Fixed wrong attribute for extent
alexandercerutti Mar 6, 2024
91b920f
Moved time attributes parsing to TimeContext
alexandercerutti Mar 10, 2024
9dba3f4
Scope: moved parent contexts association earlier in execution in orde…
alexandercerutti Mar 10, 2024
94a4d03
Removed div and body attributes check to prevent cue parsing failing …
alexandercerutti Mar 10, 2024
f9d6d89
Added support to decimals in unit regex
alexandercerutti Mar 10, 2024
3cf1b88
Fixed infinite loop on Tokenizer
alexandercerutti Mar 15, 2024
835d945
Added break line support when parsing children
alexandercerutti Mar 16, 2024
b0213fc
Added ProcessorSelectorElement to select and save last used processor…
alexandercerutti Mar 24, 2024
bf5ee18
Improved string type for styles
alexandercerutti Mar 24, 2024
107dc7c
Renamed excludeUnsupportedStyleAttributes in extractStyleAttributes
alexandercerutti Mar 24, 2024
9ea28e6
Added styles-to-css attributes remapping map
alexandercerutti Apr 1, 2024
d83e6eb
Added a synthetic xml:id, explanation and break when looking for a re…
alexandercerutti Apr 1, 2024
8b6c9b8
Changed Content element searching for a region and added explanation …
alexandercerutti Apr 1, 2024
21bd0cd
Added todo comment for tests to be written
alexandercerutti Apr 1, 2024
6006c24
Added todo comment to handle extent and origin as attributes on div a…
alexandercerutti Apr 1, 2024
624935a
Removed check which was preventing break (br) children to be used cor…
alexandercerutti Apr 1, 2024
aa4cb2f
Added looking for nested regions only if no associated regions are av…
alexandercerutti Apr 1, 2024
e736cf5
Added previous cue entities to current one if this considered a times…
alexandercerutti Apr 1, 2024
1152f41
Added forgotten getRegionsById in RegionContext
alexandercerutti Apr 3, 2024
f538437
Added comment to explain the non-support to tts:extent on tt (root)
alexandercerutti Apr 4, 2024
1c082da
Added comment on Tokenizer
alexandercerutti Apr 14, 2024
860c93b
Added parsing for ttp:cellResolution
alexandercerutti Apr 14, 2024
4fe1876
Added length unit parsing function
alexandercerutti Apr 14, 2024
8085d3d
Added lwsp file to group the parsing all together
alexandercerutti Apr 14, 2024
1567607
Improved Scalar type
alexandercerutti Apr 14, 2024
4c712b4
Moved asNumbers functions to dedicated file ad added preventZero and …
alexandercerutti Apr 14, 2024
7a5dd40
Removed additional zero check on cellResolution
alexandercerutti Apr 14, 2024
6f7ea85
Added comment for cellResolution
alexandercerutti Apr 15, 2024
d59c96b
Added converted for cell unit and changed Scalar and Percentage inter…
alexandercerutti Apr 15, 2024
cbf3913
Added scope to be passed from contexts to memoizationFactory
alexandercerutti Apr 18, 2024
bccc6de
Changed mappers signature and types to emit always only one format
alexandercerutti Apr 20, 2024
dcaddfd
Added scope support to mappers
alexandercerutti Apr 20, 2024
82605ee
Changed SupportedCSSProperties value
alexandercerutti Apr 20, 2024
3afd3ff
Set StyleParser to perform CSS style conversion
alexandercerutti Apr 20, 2024
d3185f2
Exported isCellScalar function
alexandercerutti Apr 21, 2024
f05b93e
Inverted parameters for getCellConvertedValueFromScalarToPixel
alexandercerutti Apr 21, 2024
acfccb5
Merged scalar and percentages to Length type; added createLength with…
alexandercerutti Apr 24, 2024
c8b7d78
Added initial fontSize remapping
alexandercerutti Apr 25, 2024
10b3928
Exported convertAttributesToCSS
alexandercerutti Apr 25, 2024
f86ff35
Changed styles mapping from unknown to string
alexandercerutti Apr 25, 2024
eaf0bf2
Fixed unit regex
alexandercerutti Apr 26, 2024
6a64ff6
Merged logic to extract the first inline region when looking inside c…
alexandercerutti May 26, 2024
ee515ec
Improved RelationshipTree with self reference function
alexandercerutti May 27, 2024
ce51be7
Fixed CSS remapping for text-decoration
alexandercerutti Jun 1, 2024
4bc74fb
Added some tests containers
alexandercerutti Jun 16, 2024
fd3e8a9
Added support to multiple style IDREFS
alexandercerutti Jun 16, 2024
a2e9d4f
Upgraded prettier
alexandercerutti Jun 18, 2024
89a1fff
Upgraded Typescript
alexandercerutti Jun 18, 2024
fa1ff40
Changed how Style properties are defined
alexandercerutti Jun 18, 2024
b35b4e4
Added TemporalActiveContext
alexandercerutti Jun 20, 2024
5c5500b
Moved time units and expressions to units folder
alexandercerutti Jul 16, 2024
9fba4be
Fixed checks on DocumentContext
alexandercerutti Jul 16, 2024
606e362
Improved TimeBase and matchers and their tests
alexandercerutti Jul 29, 2024
42fedcc
Removed useless variable
alexandercerutti Jul 31, 2024
5f350c2
Added comment to explicit how wallClockTime is forbidden when timebas…
alexandercerutti Jul 31, 2024
cd5bd09
Improved frames clamping and descriptions
alexandercerutti Jul 31, 2024
4f5caba
Fixed subframes parsing to allow multiple 0s after decimal point
alexandercerutti Jul 31, 2024
90a4712
Added back check to allow 0-values frames
alexandercerutti Jul 31, 2024
c093f1c
Fixed referenceBegin position in formula
alexandercerutti Aug 1, 2024
045d5e0
Moved and partially fixed referenceBegin providing to timeprovider ge…
alexandercerutti Aug 2, 2024
c16719b
Fixed signatures for timebase throwing methods
alexandercerutti Aug 3, 2024
7c109da
Fixed offset fraction parsing
alexandercerutti Aug 3, 2024
5fd8756
Removed useless exports
alexandercerutti Aug 3, 2024
4074f27
Improved Media offset time milliseconds conversion and comments
alexandercerutti Aug 3, 2024
8689f26
Improved fraction usage on offset-time usage with Media time base
alexandercerutti Aug 3, 2024
0090e70
Improved Time bases symbols descriptions
alexandercerutti Aug 3, 2024
136c8b0
Improved offset-time milliseconds conversion when using Clock Time Base
alexandercerutti Aug 4, 2024
a6f04d2
Added ceiling to ticks offset-time
alexandercerutti Aug 4, 2024
dec7570
Fixed wrong sum of timeCount for offset-time and frame metric
alexandercerutti Aug 4, 2024
c3409e0
Added generic unit interface to uniform all the elaborations
alexandercerutti Aug 4, 2024
b64766b
Added Clock timebase clock-time assertions for frame and subframes
alexandercerutti Aug 4, 2024
8b1d82c
Removed fractional part removal from clock-time on Media and SMPTE ti…
alexandercerutti Aug 4, 2024
709928b
Embedded fraction in time-count for offset-time in both Media and Clo…
alexandercerutti Aug 5, 2024
477deb7
Moved check and error firing for length back to toLength
alexandercerutti Aug 5, 2024
cea81e1
Converted time expressions and timebases to use Unit
alexandercerutti Aug 5, 2024
d5e94ff
Fixed TimeExpressions tests
alexandercerutti Aug 5, 2024
3778e4d
Fixed clock time base tests and added tests for media time base
alexandercerutti Aug 5, 2024
3387e84
Replaced old types and renamed toClockTimeMatch to createClockTimeUnit
alexandercerutti Aug 6, 2024
e46c7cb
Improved explanation for SMPTE drop frame
alexandercerutti Aug 7, 2024
af7f693
Fixed SMPTE milliseconds conversion from clock-time
alexandercerutti Aug 8, 2024
5ea7e20
Added some tests for SMPTE and timecode DF and NDF
alexandercerutti Aug 8, 2024
f045cff
Added jsconfig.json for ts config in tests
alexandercerutti Aug 9, 2024
bac89ef
Fixed broken imports of createLength with createUnit
alexandercerutti Aug 10, 2024
5315bb3
Merge branch 'develop' into feature/ttml-adapter
alexandercerutti Aug 10, 2024
e50bf5e
Renamed peekEvaluate to peekAdvance for better semantics
alexandercerutti Aug 11, 2024
ed800d6
Reworked Tokenized to improve peeking and advancing with a more robus…
alexandercerutti Aug 12, 2024
e518d7a
Removed the possibility from the Tokenizer to emit Tag Token when emp…
alexandercerutti Aug 12, 2024
e29c9a1
Removed ContentBlockReader and merged the logic inside Adapter for be…
alexandercerutti Aug 12, 2024
e0761af
Removed pre-emettibility from adapter as useless
alexandercerutti Aug 12, 2024
e06e53b
Removed doubt comment for milliseconds and fraction as, after the ans…
alexandercerutti Aug 13, 2024
d0cf207
Fixed subframes value to be parsed as an integer as it could work on …
alexandercerutti Aug 14, 2024
4f0a755
Improved comment on fractional part and time conversion
alexandercerutti Aug 14, 2024
76caa81
Replaced RelationshipTree with RepresentationTree to have a better ch…
alexandercerutti Sep 1, 2024
cae5dad
Temporarely commented old and probably useless check
alexandercerutti Sep 2, 2024
73470f2
Added check to ignore inline region elements that do not match with p…
alexandercerutti Sep 2, 2024
76e702b
Removed old check on div and body
alexandercerutti Sep 2, 2024
650eec3
Omitted br from check for inline region
alexandercerutti Sep 2, 2024
2622164
Renamed BLOCK_CLASS to BLOCK_CLASS_ELEMENT and added INLINE_CLASS_ELE…
alexandercerutti Sep 2, 2024
ce27f73
Added example for pruning
alexandercerutti Sep 2, 2024
1ed9573
Added check to ignore parent element if we find an inline region elem…
alexandercerutti Sep 2, 2024
b8b3fbe
Added missing continue
alexandercerutti Sep 2, 2024
7ec8b6c
Added initial support to region registration to a TemporalActiveContext
alexandercerutti Sep 2, 2024
a137540
Removed GROUP_TRACKED Attribute and consequential checks
alexandercerutti Sep 3, 2024
1eeb216
Added initial implementation check on END_TAG to process inline regions
alexandercerutti Sep 3, 2024
b8a9c4e
Added comments and removed potentially wrong pop
alexandercerutti Sep 3, 2024
77a02c6
Renamed RegionContext and StyleContext to RegionContainerContext and …
alexandercerutti Sep 4, 2024
f619c92
Added ignoring region in layout element if it doesn't have an xml:id
alexandercerutti Sep 7, 2024
c16ef19
Added style idref acceptance and resolvign in TemporalActiveContext
alexandercerutti Sep 7, 2024
1120243
Added styled from region merging in TemporalActiveContext
alexandercerutti Sep 8, 2024
0601dd4
Added timeContext and temporalActiveContext creation when an element …
alexandercerutti Sep 8, 2024
2a483ba
Improved xml:id assigning for inline-regions
alexandercerutti Sep 8, 2024
e7a2a3e
Added creation fo a regionContainerContext to index the inline region
alexandercerutti Sep 8, 2024
7f266f4
Added usage of original xml:id in inline regions and then fallback
alexandercerutti Sep 8, 2024
750ca8e
Removed function findInlineRegionInChildren
alexandercerutti Sep 10, 2024
a4165fc
Renamed getRegionsById to getRegionById to return only one element
alexandercerutti Sep 10, 2024
aa1e296
Added region getter based on IDRef to TemporalActiveContext
alexandercerutti Sep 11, 2024
4d26275
Added check for tt on END_TAG to prevent crashes when going up
alexandercerutti Sep 11, 2024
dd970c4
Added comment
alexandercerutti Sep 11, 2024
4da04ba
Fixed binding issue with Kleene OR operator
alexandercerutti Sep 11, 2024
1c1ac12
Added Kleene nodes delegation when a child is a Kleene operator
alexandercerutti Sep 11, 2024
bbc6a8e
Remove part of region condition to cut out elements with default regi…
alexandercerutti Sep 11, 2024
bd5ca35
Fixed kleene or operator destinations to use the matched one
alexandercerutti Sep 11, 2024
ef189e2
Added check for Kleene operator delegation and fixed zeroOrOne delega…
alexandercerutti Sep 13, 2024
42a1052
Improved Visitor readability
alexandercerutti Sep 23, 2024
4b6662f
Refactored Adapter a bit to make it easier to read
alexandercerutti Sep 28, 2024
f37bc02
Changed style tags processing to return an array of objects to be sen…
alexandercerutti Sep 29, 2024
3a51608
Added getStyledByRegionId on RegionContainerContext and added usage i…
alexandercerutti Sep 30, 2024
8ea1bb3
Reworked initial region and style asociation when parsing cues
alexandercerutti Sep 30, 2024
bf160d0
Moved region check on start tag before the block class parent element…
alexandercerutti Oct 5, 2024
6c28d47
Refactored checks on Start_tag to improve readability and to fix regi…
alexandercerutti Oct 6, 2024
3555136
Removed old and unused references to NodeQueue, Node and WithParent
alexandercerutti Oct 7, 2024
f4e5d4f
Removed unused method NodeTree.prototype.ascend
alexandercerutti Oct 7, 2024
e3536be
Moved public static method (but unused outside) to be a function
alexandercerutti Oct 7, 2024
0e37f6e
Added check for anonymous spans
alexandercerutti Oct 27, 2024
cf8e023
Added check on inline class elements if they have any region, in orde…
alexandercerutti Oct 27, 2024
da9afb8
Set regionContext to be optional when checking for a region
alexandercerutti Oct 27, 2024
1b43a22
Added getters for regionIdRef and stylesIDRefs
alexandercerutti Oct 27, 2024
a99f496
Added check to terminate earlier checks about elements that can flow …
alexandercerutti Oct 27, 2024
a2b994a
Added check to ignore element with region attribute if default region…
alexandercerutti Oct 27, 2024
9719a0b
Added timing attributes to region
alexandercerutti Oct 27, 2024
abd1b54
Added timing attributes from a region an element flowed into
alexandercerutti Oct 27, 2024
f95fffc
Added association of current destination with the NodeTree node in or…
alexandercerutti Nov 5, 2024
ee79b32
Fixed condition for which an inline region is verified
alexandercerutti Nov 9, 2024
067a0b0
Added scope to NodeRepresentations structure in order to clean it onl…
alexandercerutti Nov 9, 2024
cd9a632
Fixed wrong item used to check if element can flow in region
alexandercerutti Nov 9, 2024
17de1b4
Changed check on cue parsing
alexandercerutti Nov 9, 2024
2c9c10d
Improved comment
alexandercerutti Nov 9, 2024
5fa008c
Added support to ttpMarkerMode
alexandercerutti Nov 9, 2024
d7fc20b
Added check to throw when dur attribute is defined and we are in smpt…
alexandercerutti Nov 9, 2024
af0e679
Improved TimeContext comments and fixed lack of parenthesis
alexandercerutti Nov 10, 2024
bd81119
Removed TimeContextProxy. Not needed anymore
alexandercerutti Nov 10, 2024
d650607
Improved definition of contexts by extending a Scope interface with t…
alexandercerutti Nov 10, 2024
8a5072c
Autoformat
alexandercerutti Nov 10, 2024
879c0a3
Fixed endTime to add startTime + dur when end is missing
alexandercerutti Nov 10, 2024
8fd7c0e
Added timing attributes on div and body
alexandercerutti Nov 10, 2024
b68bd17
Fixed region flowing of nested children by adding a check to see if t…
alexandercerutti Nov 10, 2024
a044473
Improved cue parsing
alexandercerutti Nov 11, 2024
9ad483f
Added check in Scope to exclude context if contextFactory returned fa…
alexandercerutti Nov 11, 2024
c618ec8
Renamed parseREgion extractStylesChildren in processStylesChildren
alexandercerutti Nov 11, 2024
7bcc611
Added merge logic for TemporalActiveContext
alexandercerutti Nov 11, 2024
295e557
Set getRegionById to use find instead of filter
alexandercerutti Nov 11, 2024
36795b1
Added comment on flowing into region and timing attributes
alexandercerutti Nov 11, 2024
eee44c7
Fixed condition to create a new cue from a span
alexandercerutti Nov 11, 2024
ba319f6
Fixed timeContainer reading on Anonymous spans (wrong time container …
alexandercerutti Nov 11, 2024
3b2960a
Removed tests section moved to Adapter
alexandercerutti Nov 11, 2024
2ec22dc
Fixed TAC optionality
alexandercerutti Nov 11, 2024
a33fdeb
Improved Adapter tests
alexandercerutti Nov 12, 2024
5e463e8
Fixed TimeContext test
alexandercerutti Nov 12, 2024
c2db7cd
Fixed TimeExpressions tests
alexandercerutti Nov 12, 2024
fe04da4
Added tts:extent mapper to parseStyle in order to remove it from regi…
alexandercerutti Nov 15, 2024
3288707
Added links comment for all the style properties mapped
alexandercerutti Nov 17, 2024
e238d98
Added toClamped unit util
alexandercerutti Nov 17, 2024
6aa64f3
Added value clamping through unit clamp util to extentMapper
alexandercerutti Nov 17, 2024
750be95
Added originMapper
alexandercerutti Nov 17, 2024
fd7f2e4
Removed origin and extent things from TTMLRegion to tidy up a bit. Wi…
alexandercerutti Nov 17, 2024
a253d55
Exported TTMLRegion
alexandercerutti Nov 23, 2024
3302a89
Improved region styles generation by reading its style attribute
alexandercerutti Nov 23, 2024
7237e5e
Changed return type of toLength
alexandercerutti Nov 23, 2024
24a2a85
Removed useless casting and reorganized code
alexandercerutti Nov 24, 2024
a66a215
Added forgotten import
alexandercerutti Nov 24, 2024
c7a6aeb
Temporarily removed unused imports
alexandercerutti Nov 24, 2024
f270a37
Added DestinationFactory type
alexandercerutti Nov 30, 2024
9f05c68
Improved readability of RepresentationTree
alexandercerutti Nov 30, 2024
ce69af6
Removed idref parameter from createStyleParser's executor
alexandercerutti Nov 30, 2024
0fb2a8c
Removed styleParser from createRegionParser as unused (moved internal…
alexandercerutti Nov 30, 2024
f81b591
Added storage as parameter for memoizationFactory
alexandercerutti Nov 30, 2024
74b424c
Moved scope contexts merging to happen through a symbol (hook)
alexandercerutti Nov 30, 2024
791b6d8
Added onAttachedSymbol and args getter to retrieve the arguments the …
alexandercerutti Dec 1, 2024
de1e3a8
Set StyleContainerContext to process styles as containers as soon as …
alexandercerutti Dec 1, 2024
a1a0b1d
Removed style parser early cache creation and style attributes extrac…
alexandercerutti Dec 1, 2024
dcb1286
Added link in StyleContainerContext
alexandercerutti Dec 1, 2024
0b19c5a
Moved chained referencial style resolution to style container context
alexandercerutti Dec 1, 2024
1dc51b4
Added forgotten extensions and improved import type
alexandercerutti Dec 1, 2024
1fa88d1
Added now mandatory scope to createRegionParser
alexandercerutti Dec 1, 2024
8ead8c7
Removed unused StyleContainerContext styles property
alexandercerutti Dec 1, 2024
8f966b6
Removed unused property styleParserGetterSymbol
alexandercerutti Dec 1, 2024
d3aa4c5
Added looking for inherited styles in parent as well
alexandercerutti Dec 1, 2024
4b1589c
Commented unused Tokenizer functions
alexandercerutti Dec 1, 2024
d7b818f
Added attaching event on addContext
alexandercerutti Dec 1, 2024
6dbdb6e
Fixed checks on chainedReferentialStyles existence
alexandercerutti Dec 1, 2024
1b89b18
Changed getStylesByRegionId to return an array of TTMLStyle instead o…
alexandercerutti Dec 1, 2024
296b24e
Fixed styles conversion key-value extraction
alexandercerutti Dec 1, 2024
f4b7810
Moved region processing on context attach
alexandercerutti Dec 1, 2024
b0b4a3d
Changed merging of region contexts
alexandercerutti Dec 1, 2024
19ee239
Changed how styles are handled in region parser
alexandercerutti Dec 2, 2024
1fb7098
Splitted styles in TemporalActiveContext
alexandercerutti Dec 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"jest": "^29.4.3",
"jest-environment-jsdom": "^29.4.3",
"lerna": "^6.6.1",
"prettier": "^2.8.4",
"typescript": "^4.9.5"
"prettier": "^3.2.5",
"typescript": "^5.4.5"
}
}
2 changes: 1 addition & 1 deletion packages/captions-renderer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"module": "lib/index.js",
"type": "module",
"peerDependencies": {
"@sub37/server": "^1.0.0"
"@sub37/server": "workspace:^"
},
"scripts": {
"build": "rm -rf lib && npx tsc -p tsconfig.build.json",
Expand Down
105 changes: 93 additions & 12 deletions packages/captions-renderer/specs/renderer.spec.pw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,36 +143,64 @@ STYLE

const [bgColor1, bgColor2] = await Promise.all([
regionsLocator
.locator('span[voice="Fred"]')
.locator('span[voice="Fred"] > span')
.evaluate((element) => element.style.backgroundColor),
regionsLocator
.locator('span[voice="Bill"]')
.locator('span[voice="Bill"] > span')
.evaluate((element) => element.style.backgroundColor),
]);

expect(bgColor1).toBe("red");
expect(bgColor2).toBe("blue");
});

test("Renderer with a region of 3.2em height should be rounded to 4.5 to fit the whole next line if the line height is 1.5em and roundRegionHeightLineFit is set", async ({
test("An entity wrapping part of a word, should be rendered as such", async ({
page,
waitForEvent,
seekToSecond,
pauseServing,
}) => {
/**
* @typedef {import("../../sample/src/customElements/fake-video")} FakeHTMLVideoElement
*/

const TEST_WEBVTT_TRACK = `
WEBVTT

REGION
id:fred
width:40%
lines:3
regionanchor:0%,100%
viewportanchor:10%,90%
scroll:up
00:00:00.000 --> 00:00:20.000
I am Fred<i>-ish</i>
`;

00:00:00.000 --> 00:00:20.000 region:fred align:left
<v Fred>Hi, my name is Fred
await Promise.all([
waitForEvent("playing"),
page.getByRole("textbox", { name: "WEBVTT..." }).fill(TEST_WEBVTT_TRACK),
]);

await pauseServing();
await seekToSecond(3);

const regionsLocator = page.locator("captions-renderer > main > .region span");
const evaluation = await regionsLocator.evaluate((element) =>
Array.prototype.map.call(element.childNodes, (e: HTMLElement) => e.textContent),
);

expect(evaluation[3]).toBe(" -ish");
});

test("A global-style should get applied to all the cues", async ({
page,
waitForEvent,
seekToSecond,
pauseServing,
}) => {
const peachpuff = `rgb(255, 218, 185)`;
const TEST_WEBVTT_TRACK = `
WEBVTT

STYLE
::cue {
color: peachpuff;
}

00:00:02.500 --> 00:00:22.500 align:right
<v Bill>Hi, I’m Bill
Expand All @@ -194,6 +222,59 @@ scroll:up

00:00:12.500 --> 00:00:32.500 region:fred align:left
<v Fred>OK, let’s go.
`;

await Promise.all([
waitForEvent("playing"),
page.getByRole("textbox", { name: "WEBVTT..." }).fill(TEST_WEBVTT_TRACK),
]);

await pauseServing();
await seekToSecond(3);

const regionsLocator = page.locator("captions-renderer > main > .region span");

const fredLocator = regionsLocator.locator('span[voice="Fred"]');
const billLocator = regionsLocator.locator('span[voice="Bill"]');

expect(fredLocator.isVisible()).toBeTruthy();
expect(billLocator.isVisible()).toBeTruthy();

const [textColorFred, textColorBill] = await Promise.all([
fredLocator.evaluate((element) =>
getComputedStyle(element.children[0]).getPropertyValue("color"),
),
billLocator.evaluate((element) =>
getComputedStyle(element.children[0]).getPropertyValue("color"),
),
]);

expect(textColorFred).toBe(peachpuff);
expect(textColorBill).toBe(peachpuff);
});

test("Renderer with a region of 3.2em height should be rounded to 4.5 to fit the whole next line if the line height is 1.5em and roundRegionHeightLineFit is set", async ({
page,
waitForEvent,
seekToSecond,
pauseServing,
}) => {
const TEST_WEBVTT_TRACK = `
WEBVTT

REGION
id:fred
width:40%
lines:3
regionanchor:0%,100%
viewportanchor:10%,90%
scroll:up

00:00:00.000 --> 00:00:20.000 region:fred align:left
<v Fred>Hi, my name is Fred

00:00:02.500 --> 00:00:22.500 region:bill align:right
<v Bill>Hi, I’m Bill
`;

/**
Expand Down
Loading