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

Add TS to Cue utilities. #2202

Merged
merged 22 commits into from
Jun 5, 2019
Merged

Add TS to Cue utilities. #2202

merged 22 commits into from
Jun 5, 2019

Conversation

itsjamie
Copy link
Collaborator

@itsjamie itsjamie commented Apr 2, 2019

This PR will...

Progress towards Typescriptifying HLS.js

Why is this Pull Request needed?

For easy dev.

Are there any points in the code the reviewer needs to double check?

CEA-608 parser review closely.

Resolves issues:

N/A, move towards #2070

Checklist

  • changes have been done against master branch, and PR does not conflict

@itsjamie itsjamie requested a review from tjenkinson April 2, 2019 14:45
Copy link
Member

@michaelcunningham19 michaelcunningham19 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍

src/utils/cea-608-parser.ts Outdated Show resolved Hide resolved
src/utils/ewma-bandwidth-estimator.ts Outdated Show resolved Hide resolved
} catch (err) {
// for IE11
event = document.createEvent('Event');
event.initEvent('addtrack', false, false);
}
event.track = track;
(event as any).track = track;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this PR is specific to TS conversion, but for a future change - we might be able to use a TrackEvent instead of Event

https://developer.mozilla.org/en-US/docs/Web/API/TrackEvent

@@ -16,8 +25,8 @@ export default class OutputFilter {
this.startTime = null;
}

newCue (startTime, endTime, screen) {
if (this.startTime === null || this.startTime > startTime) {
newCue (startTime: number | null, endTime: number, screen: CaptionScreen) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we keep this.time a number in the parser, we don't have to do this

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 I used a sentinel value of -1 to replace where null was.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made the sentinel value a const, and export it for usage in OutputFilter now.

This removed the need to check if startTime was null.

Still need to check the (this.startTime > startTime) so that it remains the smallest value passed to it that isn't the sentinel.

Copy link
Collaborator

@johnBartos johnBartos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments

@itsjamie
Copy link
Collaborator Author

itsjamie commented May 7, 2019

My handling of the OutputFilter is wrong. Will fix in AM.

@itsjamie
Copy link
Collaborator Author

itsjamie commented May 8, 2019

Fixed the issue with OutputFilter.

@itsjamie itsjamie dismissed stale reviews from johnBartos and michaelcunningham19 May 14, 2019 22:37

Addressed the comments.

@itsjamie
Copy link
Collaborator Author

itsjamie commented May 25, 2019

After speaking on the bi-weekly call two weeks ago, John thought removing the null (aa79f56) would clean it up. But there wasn't a good default value to use, so had to use a sentinel value, after seeing it, asked for it to be reverted (94b88c1). This is where we are now.

@johnBartos johnBartos merged commit 2c7ecbb into master Jun 5, 2019
@itsjamie itsjamie deleted the type-some-utilities branch April 12, 2020 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants