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

Emulate HTMLTrackElement to enable load event. #2804

Closed
wants to merge 20 commits into from

Conversation

chemoish
Copy link
Member

Figure out when track elements are loaded so we can manipulate cues without having to do setTimeout hacks.

Addresses #2784.

Also addresses (maybe) #2799.

let track = tracks[i];

if (track['kind'] === this.kind_) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Followed #1949

@pam
Copy link

pam commented Nov 11, 2015

Tests failed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: BUSTED

Commit: d318bcc2d401d2744a7454e9c00bcd47435c0b4f
Build details: https://travis-ci.org/pam/video.js/builds/90449472

(Please note that this is a fully automated comment.)


import * as browser from '../utils/browser.js';

class HtmlTrackElementList {
Copy link
Member Author

Choose a reason for hiding this comment

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

Followed TextTrackList even if this wasn't shimming anything.

@gkatsev
Copy link
Member

gkatsev commented Nov 11, 2015

Awesome, I'll take a look tomorrow.

@chemoish
Copy link
Member Author

Will need help:

  1. browser compatibility
  2. testing strategy
  3. probably needs more documentation—fit with existing jsdoc integration

Works (OSX 10.10.5):

  • Chrome 46 (mp4, mpeg-dash [did not test drm])
  • Safari 8.0.8
  • Firefox 40
  • IE 11 Windows 8.1 (virtualbox)

this.remoteTextTracks() and this.remoteTextTrackEls() work as expected.

@@ -269,7 +271,15 @@ var loadTrack = function(src, track) {
}

track.loaded_ = true;
parseCues(responseBody, track);

if (typeof window['WebVTT'] !== 'function') {
Copy link
Member Author

Choose a reason for hiding this comment

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

add comments if this isn't an issue in any environment beyond local.

Copy link
Member

Choose a reason for hiding this comment

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

This is for the alt/video.novtt.js build.

@gkatsev
Copy link
Member

gkatsev commented Nov 16, 2015

Thanks, this is definitely the right track, if you will ;)

});

if (browser.IS_IE8) {
return this;
Copy link
Member Author

Choose a reason for hiding this comment

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

fix ^

@pam
Copy link

pam commented Nov 18, 2015

Tests failed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: BUSTED

Commit: 54b35f881b1d1968f4c6e56ee65aac362145fcc7
Build details: https://travis-ci.org/pam/video.js/builds/91732554

(Please note that this is a fully automated comment.)

Carey Hinoki added 10 commits December 7, 2015 15:20
…indow.WebVTT` is inlined):

1. Create a `TextTrack`
2. Added `TextTrack` to `TextTrackList`
3. Loaded `TextTrack.cues` (!= null)

All before the `htmlTrackElement` was added to `this.remoteTextTrackEls()` within `addRemoteTextTrack()`.
…ks correctly from DOM.

- Added documentation
- Added player test
- Added api test

NOTE: important that `addTrack_` order matters in tech.js::addRemoteTextTrack.
@chemoish chemoish force-pushed the feature/text-track-element branch from 6b29dbc to eec4a2c Compare December 7, 2015 23:22
@@ -835,6 +835,39 @@ test('createModal()', function() {
strictEqual(player.children().indexOf(modal), -1, 'modal was removed from player\'s children');
});

test('should return correct remote text track values', function () {
Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure where this should go or how this should be tested.

  • Note: techOrder: ['html5']

techFaker doesn't initialize the <track> correctly, but fires the player.addRemoteTextTrack correctly. Open to recommendations.

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 it probably would be better to move this test into test/tracks/tracks.test.js

@chemoish
Copy link
Member Author

chemoish commented Dec 7, 2015

Tested <track>:

  • IE 11 Win 8.1 (virtualbox)
  • Chrome (latest)
  • Safari (latest)
  • FF (latest)

Tested addRemoteTextTrack:

  • IE 11 Win 8.1 (virtualbox)
  • Chrome (latest)
  • Safari (latest)
  • FF (latest)

All passed.

@chemoish
Copy link
Member Author

chemoish commented Dec 7, 2015

Tests pass locally. FF doesn't pass.

@gkatsev
Copy link
Member

gkatsev commented Dec 7, 2015

We also should add some tests for the new functionality of addRemoteTextTrack as well as tests for remoteTextTracksEls()

@chemoish
Copy link
Member Author

chemoish commented Dec 8, 2015

I am down for better tests, but what specifically did you have in mind?

The only new functionality specified for addRemoteTextTrack was the addition of managing the remoteTextTrackEls.

tech::addRemoteTextTrack did unify the return of the htmlTrackElement, would that be beneficial to test?

@gkatsev
Copy link
Member

gkatsev commented Dec 8, 2015

Yep, basically just a simple test that verifies that when you call addRemoteTextTrack you can then see the element that was returned in the remoteTextTrackEls list.

- Add html track element test
@gkatsev
Copy link
Member

gkatsev commented Dec 8, 2015

Sweet, LGTM.

@gkatsev gkatsev added this to the Text Tracks milestone Dec 8, 2015
@chemoish chemoish closed this in 8f2bc92 Dec 8, 2015
@gkatsev
Copy link
Member

gkatsev commented Dec 8, 2015

Merged! Thanks @chemoish. Also, thanks @OwenEdwards for the initial workup oh so long ago :)

jgubman added a commit to jgubman/video.js that referenced this pull request Jan 27, 2016
* upstream/stable: (479 commits)
  v5.4.4
  @gkatsev switched to use custom vtt.js from npm. closes videojs#2905
  v5.4.3
  @gkatsev updated options customizer and github-release options. closes videojs#2903
  v5.4.2
  @gkatsev updated grunt-release config. closes videojs#2900
  v5.4.1
  @gkatsev added chg- and github- release for next releases. closes videojs#2899
  v5.4.0
  @gkatsev added ability to release next tag from master. closes videojs#2894
  @gkatsev added nullcheck for cues in updateForTrack. Fixes videojs#2870. closes videojs#2896
  @chemoish emulated HTMLTrackElement to enable track load events. closes videojs#2804
  @gkatsev added a Player#reset method. Fixes videojs#2852. closes videojs#2880
  @nick11703 changed multiline comments in sass with single-line comments. closes videojs#2827
  @gkatsev added Player#tech. Fixes videojs#2617. closes videojs#2883
  @misteroneill updated videojs-ie8 to 1.1.1. closes videojs#2869
  v5.3.0
  @imbcmdth added sourceOrder option for source-first ordering in selectSource. closes videojs#2847
  @forbesjo updated formatTime to not go negative. closes videojs#2821
  v5.2.4
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor This PR can be added to a minor release. It should not be added to a patch release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants