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

fix: cues at startTime 0 do not fire #4152

Merged
merged 4 commits into from
Mar 2, 2017
Merged

Conversation

brandonocasey
Copy link
Contributor

Description

Previously timeupdate would fire before the video was playing, and the tech was not ready. This caused issues when preload was set to auto, because cuechange would fire before the video was even started for cues with a startTime of 0.

  • Wait for tech to be ready before watching for timeupdate
  • update unit tests to use TechFaker
  • Add a unit test to verify that we wait for Tech to be ready.

Specific Changes proposed

Please list the specific changes involved in this pull request.

Requirements Checklist

  • Feature implemented / Bug fixed
  • If necessary, more likely in a feature request than a bug fix
    • Change has been verified in an actual browser (Chome, Firefox, IE)
    • Unit Tests updated or fixed
  • Reviewed by Two Core Contributors

brandonocasey and others added 4 commits March 2, 2017 11:48
* Wait for tech to be ready before watching for `timeupdate`
* update unit tests to use TechFaker
* Add a unit test to verify that we wait for Tech to be ready.
@@ -339,14 +344,17 @@ class TextTrack extends Track {
addCue(originalCue) {
let cue = originalCue;

if (!(originalCue instanceof window.vttjs.VTTCue)) {
if (window.vttjs && !(originalCue instanceof window.vttjs.VTTCue)) {
cue = new window.vttjs.VTTCue(originalCue.startTime, originalCue.endTime, originalCue.text);

for (const prop in originalCue) {
if (!(prop in cue)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

should we just do || prop === id instead of copying it below? Doesn't really matter all that much I guess though.

Copy link
Member

Choose a reason for hiding this comment

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

I think since we're only copying the id, having it be separate with a comment makes it much nicer and explicit. Though, if we end up needing to force copy other stuff, I'd agree combining into here would make more sense.

@gkatsev gkatsev merged commit a2b1a33 into master Mar 2, 2017
@gkatsev gkatsev deleted the fix/cue-point-starttime-0 branch March 2, 2017 19:35
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.

2 participants