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

De-XHRify #14

Merged
merged 6 commits into from
Jan 2, 2024
Merged

De-XHRify #14

merged 6 commits into from
Jan 2, 2024

Conversation

wbamberg
Copy link
Contributor

Part of openwebdocs/project#156. I had to keep the event listeners as non-arrow functions, I think because they depend on the this value.

Copy link

It looks like this is your first pull request. 🎉 Thank you for your contribution! One of the project maintainers will triage and assign the pull request for review. We appreciate your patience. To safeguard the health of the project, please take a moment to read our code of conduct.

Copy link
Member

@estelle estelle left a comment

Choose a reason for hiding this comment

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

Looks good.

Copy link
Member

@teoli2003 teoli2003 left a comment

Choose a reason for hiding this comment

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

Mostly nits, but we don't plan to reedit this file in the near future…

//Edge/IE implement "Generic Cue", other browsers VTTCue
var Cue = window.VTTCue || window.TextTrackCue;
const Cue = window.VTTCue || window.TextTrackCue;
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this is still needed: VTTCue is unlikely to be supported by Edge > 79. Anyway, TextTrackCue has been supported by every engine for ages; we can simplify this. (as well as the call to the Cue() that would be a new TextTrackCue()on line 25 and 30.
Capture d’écran 2023-12-20 à 06 42 49

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As far as I can tell the correct thing here is to use VTTCue: it's supported everywhere. TextTrackCue is an abstract class, we couldn't create it.

//create cue per timed event and render isd
for (var i = 0; i < timeEvents.length; i++) {
for (let i = 0; i < timeEvents.length; i++) {
Copy link
Member

Choose a reason for hiding this comment

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

Given that we modernize this example at the same time and astimeEvents is an Array. Can you double-check if we could use for...of here (and get rid of i? (Not 100% sure it is possible)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We use i at

if (i < timeEvents.length - 1) {
//We have to provide empty string as VTTText
var myCue = new Cue(timeEvents[i], timeEvents[i + 1], "");
which is why I didn't do this.

imscjs-demo/js/index.js Outdated Show resolved Hide resolved
imscjs-demo/js/index.js Outdated Show resolved Hide resolved
imscjs-demo/js/index.js Outdated Show resolved Hide resolved
imscjs-demo/js/index.js Outdated Show resolved Hide resolved
imscjs-demo/js/index.js Outdated Show resolved Hide resolved
imscjs-demo/js/index.js Outdated Show resolved Hide resolved
imscjs-demo/js/index.js Outdated Show resolved Hide resolved
wbamberg and others added 2 commits December 19, 2023 22:21
Co-authored-by: Jean-Yves Perrier <jypenator@gmail.com>
//We have to provide empty string as VTTText
var myCue = new Cue(timeEvents[i], timeEvents[i + 1], "");
// We have to provide an empty string as the VTTText
myCue = new VTTCue(timeEvents[i], timeEvents[i + 1], "");
Copy link
Member

@teoli2003 teoli2003 Dec 20, 2023

Choose a reason for hiding this comment

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

I think the standard is TextTrackCue. (Two places)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I know basically nothing about this API, but it looks to me like you can't construct a TextTrackCue, it doesn't have a constructor. From https://developer.mozilla.org/en-US/docs/web/api/texttrackcue:

TextTrackCue is an abstract class which is used as the basis for the various derived cue types, such as VTTCue; you will instead work with those derived types.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have tested this demo in Firefox and Chrome with VTTCue and it works, and with TextTrackCue, and it doesn't.

Copy link
Member

Choose a reason for hiding this comment

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

👍

imscjs-demo/js/index.js Outdated Show resolved Hide resolved
Co-authored-by: Jean-Yves Perrier <jypenator@gmail.com>
Copy link
Member

@teoli2003 teoli2003 left a comment

Choose a reason for hiding this comment

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

👍 Nice work. Let's wait for somebody with merge access, this is ready to be merged.

imscjs-demo/js/index.js Outdated Show resolved Hide resolved
@palemieux
Copy link
Collaborator

Just added a small suggestion clarifying terms

Co-authored-by: Pierre-Anthony Lemieux <pal@sandflow.com>
Copy link

@dipikabh dipikabh left a comment

Choose a reason for hiding this comment

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

Approving this based on other reviews to check if I have merge rights. As @teoli2003 has indicated, this PR is ready to be merged.

@dipikabh dipikabh merged commit 22903a1 into mdn:main Jan 2, 2024
2 checks passed
Copy link

github-actions bot commented Jan 2, 2024

Congratulations on your first merged pull request. 🎉 Thank you for your contribution! Did you know we have a project board with high-impact contribution opportunities? We look forward to your next contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants