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

addChaptersTrack work in append mode, Expected? #4750

Closed
WINOFFRG opened this issue Nov 23, 2022 · 6 comments · Fixed by #4810
Closed

addChaptersTrack work in append mode, Expected? #4750

WINOFFRG opened this issue Nov 23, 2022 · 6 comments · Fixed by #4810
Assignees
Labels
priority: P2 Smaller impact or easy workaround status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Milestone

Comments

@WINOFFRG
Copy link
Contributor

Have you read the Tutorials?
Yes

Have you read the FAQ and checked for duplicate open issues?
Yes

What version of Shaka Player are you using?
v4.3.0 (uncompiled)

Please ask your question
On a running stream if we call player.addChaptersTrack it appends the newly parsed chapters to the existing one, Is this an expected behavior? Shouldn't we have a comparator that sorts the chapters based on time? This way we could handle many edge cases like:

  1. Removing duplicate chapters based on id or timestamp.
  2. Adding another argument to either sort and append or overwrite chapters.
  3. warning on overlapping chapter tracks.
  4. warning on chapters that are out of timeline range.

image

In case this could be considered a fix, I can work on it.

@WINOFFRG WINOFFRG added the type: question A question from the community label Nov 23, 2022
@joeyparrish
Copy link
Member

@avelad, do I recall correctly that you wrote the chapters code? Is this a bug?

@joeyparrish joeyparrish added type: bug Something isn't working correctly priority: P2 Smaller impact or easy workaround and removed type: question A question from the community labels Dec 8, 2022
@joeyparrish
Copy link
Member

If this is wrong, @WINOFFRG is willing to work on a fix.

@avelad
Copy link
Member

avelad commented Dec 8, 2022

It’s not a bug, it’s designed to work on append mode, but we need filter duplicates…

@joeyparrish joeyparrish assigned WINOFFRG and unassigned avelad Dec 8, 2022
@joeyparrish
Copy link
Member

OK. @WINOFFRG, your PR would be welcome!

@github-actions github-actions bot added this to the v4.4 milestone Dec 8, 2022
@WINOFFRG
Copy link
Contributor Author

WINOFFRG commented Dec 9, 2022

Hi! While I was working on the fix for this, I found another issue. @avelad Can you please check and confirm this?

How are we actually handling multiple chapter tracks with same language?

shaka-player/lib/player.js

Lines 5004 to 5006 in 76f96b9

const chaptersTrack = chaptersTracks.find((t) => {
return t.language == language;
});

If you check the above function, this will always return the first track of that language. Essentially the function addChaptersTrack should return that track which has been added. Say, I am adding another track of same language i.e en because of this, It will always return the first matching track.

A solution that comes to my mind is whenever we create a trackElement we must also pass an id= for the HTMLElement to that function and then instead of verifying the track existence via language we can check for that id= and return that one.

How does this look to you?

@avelad
Copy link
Member

avelad commented Dec 9, 2022

For me, it’s ok!

avelad pushed a commit that referenced this issue Dec 10, 2022
fixes #4750

Solved by creating a `Set` for filtering out deplicate elements.

Need confirmation, Shouldn't we add an `assert` for `language` argument
passed to
https://github.com/shaka-project/shaka-player/blob/76f96b9fee2dc43b03f6803dd80c51fdc5b73a9e/lib/player.js#L4340-L4342
joeyparrish pushed a commit that referenced this issue Dec 14, 2022
fixes #4750

Solved by creating a `Set` for filtering out deplicate elements.

Need confirmation, Shouldn't we add an `assert` for `language` argument
passed to
https://github.com/shaka-project/shaka-player/blob/76f96b9fee2dc43b03f6803dd80c51fdc5b73a9e/lib/player.js#L4340-L4342
joeyparrish pushed a commit that referenced this issue Dec 14, 2022
fixes #4750

Solved by creating a `Set` for filtering out deplicate elements.

Need confirmation, Shouldn't we add an `assert` for `language` argument
passed to
https://github.com/shaka-project/shaka-player/blob/76f96b9fee2dc43b03f6803dd80c51fdc5b73a9e/lib/player.js#L4340-L4342
joeyparrish pushed a commit that referenced this issue Dec 14, 2022
fixes #4750

Solved by creating a `Set` for filtering out deplicate elements.

Need confirmation, Shouldn't we add an `assert` for `language` argument
passed to
https://github.com/shaka-project/shaka-player/blob/76f96b9fee2dc43b03f6803dd80c51fdc5b73a9e/lib/player.js#L4340-L4342
joeyparrish pushed a commit that referenced this issue Dec 14, 2022
fixes #4750

Solved by creating a `Set` for filtering out deplicate elements.

Need confirmation, Shouldn't we add an `assert` for `language` argument
passed to
https://github.com/shaka-project/shaka-player/blob/76f96b9fee2dc43b03f6803dd80c51fdc5b73a9e/lib/player.js#L4340-L4342
@github-actions github-actions bot added the status: archived Archived and locked; will not be updated label Feb 8, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 8, 2023
Robloche pushed a commit to Robloche/shaka-player that referenced this issue Feb 8, 2023
fixes shaka-project#4750

Solved by creating a `Set` for filtering out deplicate elements.

Need confirmation, Shouldn't we add an `assert` for `language` argument
passed to
https://github.com/shaka-project/shaka-player/blob/76f96b9fee2dc43b03f6803dd80c51fdc5b73a9e/lib/player.js#L4340-L4342
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
priority: P2 Smaller impact or easy workaround status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants