Skip to content

Commit

Permalink
Merge branch 'develop' into feature/add-lint-hook
Browse files Browse the repository at this point in the history
  • Loading branch information
felix-hoc authored Jan 8, 2025
2 parents c0a8a9d + 469fa84 commit f870537
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 13 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Added
- Chore: Pre-commit hook for linting TypeScript file changes

## [3.79.0] - 2025-01-08

### Fixed
- CEA-608 caption window covering almost the entire video area

### Changed
- Create separate region components for each CEA-608 row

## [3.78.0] - 2025-01-08

### Changed
Expand Down Expand Up @@ -1038,6 +1046,7 @@ Version 2.0 of the UI framework is built for player 7.1. If absolutely necessary
## 1.0.0 (2017-02-03)
- First release

[3.79.0]: https://github.com/bitmovin/bitmovin-player-ui/compare/v3.78.0...v3.79.0
[3.78.0]: https://github.com/bitmovin/bitmovin-player-ui/compare/v3.77.0...v3.78.0
[3.77.0]: https://github.com/bitmovin/bitmovin-player-ui/compare/v3.76.0...v3.77.0
[3.76.0]: https://github.com/bitmovin/bitmovin-player-ui/compare/v3.75.0...v3.76.0
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bitmovin-player-ui",
"version": "3.78.0",
"version": "3.79.0",
"description": "Bitmovin Player UI Framework",
"main": "./dist/js/framework/main.js",
"types": "./dist/js/framework/main.d.ts",
Expand Down
19 changes: 14 additions & 5 deletions src/scss/skin-modern/components/_subtitleoverlay-cea608.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use 'sass:math';

.#{$prefix}-ui-subtitle-overlay {
&.#{$prefix}-cea608 {

Expand All @@ -6,17 +8,24 @@
right: 3em;
top: 2em;

.#{$prefix}-subtitle-region-container.#{$prefix}-subtitle-position-default {
bottom: 0;
.#{$prefix}-subtitle-region-container {
height: math.div(100%, 15);
left: 0;
line-height: 1em;
right: 0;
top: 0;
text-align: left;

// Define positions for all 15 rows
@for $i from 0 through 14 {
&.#{$prefix}-subtitle-position-cea608-row-#{$i} {
top: math.div($i, 15) * 100%;
}
}
}

.#{$prefix}-ui-subtitle-label {
display: inline-block;
font-family: 'Courier New', Courier, 'Nimbus Mono L', 'Cutive Mono', monospace;
line-height: 1em;
position: absolute;
text-transform: uppercase;

// sass-lint:disable force-pseudo-nesting nesting-depth
Expand Down
19 changes: 14 additions & 5 deletions src/ts/components/subtitleoverlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ export class SubtitleOverlay extends Container<ContainerConfig> {
private static readonly CEA608_NUM_ROWS = 15;
// The number of columns in a cea608 grid
private static readonly CEA608_NUM_COLUMNS = 32;
// The offset in percent for one row (which is also the height of a row)
private static readonly CEA608_ROW_OFFSET = 100 / SubtitleOverlay.CEA608_NUM_ROWS;
// The offset in percent for one column (which is also the width of a column)
private static readonly CEA608_COLUMN_OFFSET = 100 / SubtitleOverlay.CEA608_NUM_COLUMNS;

Expand Down Expand Up @@ -198,18 +196,22 @@ export class SubtitleOverlay extends Container<ContainerConfig> {

generateLabel(event: SubtitleCueEvent): SubtitleLabel {
// Sanitize cue data (must be done before the cue ID is generated in subtitleManager.cueEnter / update)
let region = event.region;

if (event.position) {
// Sometimes the positions are undefined, we assume them to be zero
event.position.row = event.position.row || 0;
event.position.column = event.position.column || 0;

region = region || `cea608-row-${event.position.row}`;
}

const label = new SubtitleLabel({
// Prefer the HTML subtitle text if set, else try generating a image tag as string from the image attribute,
// else use the plain text
text: event.html || ActiveSubtitleManager.generateImageTagText(event.image) || event.text,
vtt: event.vtt,
region: event.region,
region: region,
regionStyle: event.regionStyle,
});

Expand Down Expand Up @@ -287,6 +289,8 @@ export class SubtitleOverlay extends Container<ContainerConfig> {
'font-size': `${fontSize}px`,
'letter-spacing': `${fontLetterSpacing}px`,
});

label.regionStyle = `line-height: ${fontSize}px;`;
}
}
};
Expand Down Expand Up @@ -321,11 +325,12 @@ export class SubtitleOverlay extends Container<ContainerConfig> {
}

label.getDomElement().css({
'left': `${event.position.column * SubtitleOverlay.CEA608_COLUMN_OFFSET}%`,
'top': `${event.position.row * SubtitleOverlay.CEA608_ROW_OFFSET}%`,
'margin-left': `${event.position.column * SubtitleOverlay.CEA608_COLUMN_OFFSET}%`,
'font-size': `${fontSize}px`,
'letter-spacing': `${fontLetterSpacing}px`,
});

label.regionStyle = `line-height: ${fontSize}px;`;
});

const reset = () => {
Expand Down Expand Up @@ -400,6 +405,10 @@ export class SubtitleLabel extends Label<SubtitleLabelConfig> {
get regionStyle(): string {
return this.config.regionStyle;
}

set regionStyle(style: string) {
this.config.regionStyle = style;
}
}

class ActiveSubtitleManager {
Expand Down

0 comments on commit f870537

Please sign in to comment.