Commit Graph

34 Commits

Author SHA1 Message Date
Aditya Mishra 415ebdc52e feat(UI): Add live subtitle style preview on hover (#10077) 2026-05-12 13:24:17 +02:00
Álvaro Velad Galván c4de8f1f53 fix: Fix alignItems usage on old devices (#9544)
start/end are supported from Chromium 93+ (see:
https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/align-items).
2026-01-05 15:04:13 +01:00
Álvaro Velad Galván c6e6082bc2 feat: Allow override subtitle position (#9522)
Close https://github.com/shaka-project/shaka-player/issues/9521

---------

Co-authored-by: Wojciech Tyczyński <tykus160@gmail.com>
2025-12-19 13:38:33 +01:00
Álvaro Velad Galván d5be5d6f45 feat!: Text displayers should receive a shaka.Player pointer (#9515)
Related to https://github.com/shaka-project/shaka-player/issues/9301
2025-12-17 10:11:00 +01:00
Álvaro Velad Galván 3618d4f4ca fix: Only create shaka-text-container when necessary (#8581) 2025-05-09 22:05:39 +02:00
Álvaro Velad Galván c8747ab0b8 feat: Move caption scaling from css to new textDisplayer.fontScaleFactor config (#8242)
Fixes
https://github.com/shaka-project/shaka-player/pull/8215#issuecomment-2711266477
2025-03-12 13:16:48 +01:00
David HM Morgan 18695c6c23 feat: Text font scaling customisation ability (#8215)
With reference to #8025, this is a partial proposal to see if this style
of extensible customisation could be favourable to the shaka-player
community:

Proposal for some accessibility options whereby an App builder can
customise subtitle/caption size, with the potential of an App offering
accessibility options for text size.

This style could be used for other text styling attributes in a similar
way, but this is just the first step.

---------

Co-authored-by: Álvaro Velad Galván <ladvan91@hotmail.com>
2025-03-06 13:44:49 +01:00
Wojciech Tyczyński 6e55a3b21b build: Forbid using dot in generic types (#7904)
Fixes #2643

Happy reviewing!
2025-01-20 09:39:51 +01:00
Álvaro Velad Galván fd78ec41f5 fix: Remove useless deprecation in UITextDisplayer and add some guards in SimpleTextDisplayer (#7805)
Fixes https://github.com/shaka-project/shaka-player/issues/7803
2024-12-24 13:02:34 +01:00
Álvaro Velad Galván fa9feb346f fix: Filter duplicate cues on text displayer append (#6949) 2024-07-01 20:29:01 +02:00
MichaelSweden d564be8e89 fix: Make UITextDisplayer constructor backward compatible (#6532)
Keep constructor backward compatible with earlier that had two
arguments, i.e. make the new third optional for existing applications.

Fixes https://github.com/shaka-project/shaka-player/issues/6531

---------

Co-authored-by: Álvaro Velad Galván <ladvan91@hotmail.com>
2024-05-06 10:11:20 +02:00
Álvaro Velad Galván de2a2d885f feat: Add TextDisplayer config (#6477) 2024-04-24 18:15:44 +02:00
Antonio Díaz Correa 42c235d123 fix: avoid uiTextDisplayer.destroy crashing if called more than once (#6022) 2024-01-08 09:40:12 +01:00
Álvaro Velad Galván 62156bae02 feat: Use shaka.text.Cue everywhere instead of shaka.extern.Cue (#5529)
Closes https://github.com/shaka-project/shaka-player/issues/2818
2023-08-25 10:51:28 +02:00
Joey Parrish dcc94b163f chore: Rename layout tests (#4907)
Also fixes a compiler error that comes up for some reason when renaming
the other tests. The compiler will accept an assignment to nestedCues,
but not pushing to it. I was unable to fix the missing type information
for this.

Related to work on PR #4767
2023-01-17 15:31:39 -08:00
David HM Morgan 5681efe95c fix: Treat regions uniquely (#4841)
Captions split over stream segment boundaries are repeated over more
than one segment.
Regions in which they sit maybe described the same but allocated
different ids and vice versa.
Proposal to treat internal region ids uniqely by encoding the dimensions
in the id.

fixes #4839
2022-12-15 19:23:41 +01:00
David HM Morgan 4081434eba fix: Fix subtitles not added to DOM region (#4733)
Reinstate previously removed region elements when next caption finds it
is not there: Detect the absence and ensure `updateDOM` is true so its
reinstated and the next caption can be shown.

Closes #4680

Co-authored-by: Joey Parrish <joeyparrish@users.noreply.github.com>
2022-12-07 14:23:12 -08:00
Joey Parrish b1f46dbc3a fix(text): Fix cue region rendering in UI (#4412)
Both TTML and VTT regions should be thought of as separate elements
from the cue structures they contain.  To this end, the UI text
displayer now creates separate region elements to represent CueRegion
objects, and the Cues attached to them nest inside those region
elements in the DOM.

Closes #4381
2022-08-16 16:37:17 -07:00
Joey Parrish 1eadfd1e20 test: Improve TextDisplayer test reliability and timing (#4136)
This seems to reduce flakiness in the TextDisplayer tests.  The
theory is that Safari throttles timers when the system is very busy,
which it often is during full test runs across multiple browsers.  By
not relying on timers and triggering an explicit update in the
TextDisplayer, the tests seem to become more reliable.
2022-04-19 10:47:39 -07:00
Joey Parrish fbbd63d96b test: Late load tests, fix Chromecast test flake (#4115)
This change fixes tests on Chromecast by loading tests later in the process.  Test scripts are now dynamically inserted by boot.js, rather than loaded by Karma.  The bootstrapping code then awaits the completion of that before starting the Karma frameworks (Jasmine) to run the tests.

This also removes the use of goog.provide/goog.require in tests and test utils.  We don't need to load test utils or library sources dynamically in each test, and this gives us more explicit control over script loading and ordering.

Closes #4094
2022-04-11 15:47:48 -07:00
Theodore Abshire 4bdd3bb65a fix(text): Force caption update when removing cues
Previously, in the updateCaptions_ method in the UI text displayer,
when trying to determine if a cue should be removed from the container,
we checked to see if it was out of the time range.
This worked in most cases, but it did have the side-effect that the
displayer would not remove the old cues if they were removed manually
via the remove() method. This was most visible if the user changed the
text language; the currently-displayed cue of the old language would
linger until it reached the point it would stop displaying normally.
This changes the UI text displayer to force an update when remove() is
called, if necessary.

Change-Id: I84a4847b67c5fb7597342a943abe13a3cc9e826e
2021-12-06 18:33:54 +00:00
Jacob Trimble cdeffbb9e6 fix(ui): Fix styling of UI text cues
First, the positioning of cues was incorrect.  We need to explicitly
set all the position attributes when we position elements with the
"absolute" position.

Second, if we position a text <span> manually, the background will fill
the whole region.  So to keep the background wrapping the text, we need
to add another <span> for the text.

Third, the background and font color should not be set on every <span>
element since it won't allow parent cues to set the inherited value.
So this moves the defaults to the top-level text element and allows
parent cue elements to override this.  It also would make app CSS
easier to override.  Because background color isn't inherited through
CSS, the default is set in JavaScript instead.

Fixes #3521
Fixes #3600
Closes #3713

Change-Id: I45fc88dcac4a0a062e1474087f24c80d98eef619
2021-11-03 17:31:25 +00:00
Theodore Abshire 7da2cd59ff fix(text): Fix UI test failures
A new UI test added in a recent CL involved manually setting the
currentTime value of a videoElement in tests.
For some reason that wasn't working on Safari, so this changes that
UI test to use a fake video instead of a real one.

Closes #3689

Change-Id: I412f677f6cda49bbfc850a9102edfe3b75bca302
2021-10-08 16:19:06 -07:00
Theodore Abshire b02ff27017 fix: Fixes updating of nested cues
Previously, we added support for respecting the time constraints
of nested cues. However, the UI text displayer did not take the
time constraints of nested cues into account when determining when
and how to update the cues.
This changes the UI text displayer to also do that.

Issue #3524
Issue #3643

Change-Id: I6b643f2aa21f367a8e40a8aca2ebb62492c071c2
2021-10-06 14:50:11 -07:00
Joey Parrish 2250324a4a fix: Fix enforcement of cue alignment styles
This uses flexbox once again to get proper positioning of cues.  To
compensate for the issues that originally made us remove flexbox, this
adds a wrapper span inside the flexbox element.

Summary of screenshot changes:
 - slight change to background sizing
   - ui-basic-cue
   - ui-cue-with-controls
   - ui-duplicate-cues
   - ui-end-time-edge-case
   - ui-flat-cue-bg
   - ui-two-basic-cues
 - background fills block with literal newline in text
   - ui-cue-with-newline
 - region anchored without padding
   - ui-region-position
 - new screenshots
   - *-nested-cues-with-linebreak
   - *-region-with-display-alignment  (regression test for this issue)

Closes #3379

Change-Id: I8c678721d96662e0f8940cda12df4f5b5e5baf1e
2021-07-09 17:19:42 +00:00
Joey Parrish fff9a96958 fix(UI): Fix writing-mode on Tizen 3
Old versions of Chromium, which may be found in certain versions of
Tizen and WebOS, may require the prefixed version of "writingMode":
"webkitWritingMode".

However, testing shows that Tizen 3, at least, has a "writingMode"
property, but the setter for it does nothing.

Therefore, instead of just detecting the existence of the property, we
need to additionally check if setting it had any effect.  If it is
either missing or non-functional, then we fall back to the prefixed
version of the property.  This fixes the functionality on Tizen 3.

We also need to change the conditions we check for in the tests, since
property existence is not enough to set the correct test expectation.

See also PR #3330

Change-Id: Ic906f3c5af956b5edd1788e95e1978eb4b3098ac
2021-04-22 17:09:25 +00:00
Álvaro Velad Galván 7af44ef565 fix(UI): Fix writing-mode support in old versions of Tizen and WebOS (#3330) 2021-04-19 10:44:17 -07:00
Álvaro Velad Galván 463b1b6886 Remove support for IE 11 (#3309)
Issue #2339
2021-04-16 13:59:35 -07:00
Jacob Trimble 9c2315e69d fix(text): Don't use flex layout in subtitles.
Using flex layout causes problems with the positioning of elements and
causes the borders to be wrapped over the whole parent.  This changes
to use block/inline layouts instead.

This also removes any padding around the cue lines, hugging the
background around the text.  This is a bit more consistent with other
renderers by having a gap between lines.  This also changes a bit of
the nested cues padding.

The deeply nested cue test is different because the `background-color`
CSS attribute isn't inherited, so the default in our CSS sets the
background to black.

Fixes #3013

Change-Id: I3e4b63b1b4de1f12e69fce2460d142e0a69bfcd9
2021-03-17 18:57:30 +00:00
michellezhuo 341b92ad04 build: add goog.require for compiler upgrade (Part1)
This change includes files under test/cea and test/text folders.

Change-Id: I1db1ccb6daeea77058cb56f1f5fc80992596600c
2020-10-07 19:20:29 +00:00
Joey Parrish 45e39f87d5 fix(text): Fix missing cues in UITextDisplayer
The duplicate cues check did not account for nested cues, which could
cause some inputs to be erroneously filtered out.  This uses a more
detailed check that includes all properties.

Change-Id: I517be17a8f7377f8840f102d26d515baa327530a
2020-08-25 16:29:26 -07:00
Joey Parrish 565bb7d880 feat(text): Clarify and clean up text Cue contract
Changes:
 - Update comments on shaka.extern.Cue to clarify how fields should be
   used and interpreted
 - Add support for arbitrarily-deep nested cues in both text
   displayers
 - Stop adding whitespace between nested cues (parsers should emit
   exactly what they want displayed) and update tests to match
 - Remove obscure special cases from UITextDisplayer styles and make
   styling consistent with the Cue docs
 - Fix rendering for single line break (cue.spacer) elements
 - Add a layout test for deeply-nested cues
 - Remove reundant and identical set of UITextDisplayer unit tests
 - Update layout test for backgrounds to reflect the clarified rules
 - Update remaining UITextDisplayer unit tests to look for div instead
   of span for top-level cues
 - Updates screenshots for region-position, which changed slightly in
   appearance due to changes in whitespace rules
 - Updates screenshots for nested-cue-bg, to reflect simplified rules
   for applying backgrounds

TODO:
 - Temporarily breaks TTML output until the TTML parser can be updated
   to conform to the clarified rules in the Cue docs
 - Still more special cases around regions in UITextDisplayer
 - Rendering for multiple line break elements in UITextDisplayer
 - Support bold, italic, and underline in SimpleTextDisplayer
 - None of the displayers will honor the wrapLine field yet

Closes #2762 (extra vertical space seen for line breaks)
Issue #2761 (deeply-nested cues)

Change-Id: I02ac8213e4de67a65fb38d596d2c59536f3722ee
2020-08-11 14:30:40 +00:00
Joey Parrish 7e6a0f38ff fix: Correct license headers in misc. files
This corrects/normalizes license headers in misc. files, such as
config files, docs, build tools, tests, and externs.  This does not
affect the compiled output, and is only done for consistency.

Issue #2638

Change-Id: I9d8da2de55243b08d7df2b743aac73c6f15e858a
2020-06-09 16:13:56 -07:00
michellezhuo 562168a1f6 Set UITextDisplayer as TextDisplayFactory in default config
In player, SimpleTextDisplayer was set as the default TextDisplayer. In
our UI, it changes the configuration to use the UITextDisplayer, and
UITextDisplayer gets constructed with the player. Later in our demo, it
resets the config, so an extra SimpleTextDisplayer gets constructed.
This introduces an extra TextTrack created by SimpleTextDisplayer.

This change sets the UITextDisplayer as the default TextDisplayer in
player's default config.

Closes #2516

Change-Id: I3f653be9fad8b2edbc2fb9de84e8abb327dcfc51
2020-05-04 20:40:18 -07:00