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

feat(FEC-8390, FEC-8246): support 608/708 captions #67

Merged
merged 10 commits into from
Jul 17, 2018
Merged

Conversation

yairans
Copy link
Contributor

@yairans yairans commented Jul 12, 2018

Description of the Changes

parse 608/708 tracks by the video element textTrack api
depends on
kaltura/playkit-js#265
kaltura/playkit-js-ui#254

CheckLists

  • changes have been done against master branch, and PR does not conflict
  • new unit / functional tests have been added (whenever applicable)
  • test are passing in local environment
  • Travis tests are passing (or test results are not worse than on master branch :))
  • Docs have been updated

@yairans yairans self-assigned this Jul 12, 2018
@yairans yairans requested review from OrenMe and dan-ziv July 12, 2018 20:04
@yairans yairans changed the title fix(FEC-8390, FEC-8246): embedded captions (608/708) doesn't work feat(FEC-8390, FEC-8246): support 608/708 captions Jul 12, 2018
dan-ziv
dan-ziv previously approved these changes Jul 13, 2018
if (textTrack instanceof TextTrack && !textTrack.active) {
if (this._hls.subtitleTracks.length) {
this._hls.subtitleTrack = textTrack.id;
HlsAdapter._logger.debug('Text track changed', textTrack);
Copy link
Contributor

Choose a reason for hiding this comment

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

The structure here is a bit inconsistent.
In if clause you have a condition and then u select a track via hls.js API and call

HlsAdapter._logger.debug('Text track changed', textTrack);
this._onTrackChanged(textTrack);
```javascript
and then in else clause you have a call to method that inside it also has exact same logic and sequence but just for native tracks.
I prefer we make it consistent:
if (condition) {
   //...
} else if (condition) {
   //...
}

I would even say you should also return a boolean or something from both methods and then conditionally call:

if (boolean) {
   HlsAdapter._logger.debug('Text track changed', textTrack);
   this._onTrackChanged(textTrack);
}

so you only have these two lines once and not twice like now.

_parseNativeTextTracks(nativeTextTracks: Array<Object>): Array<TextTrack> {
let textTracks = [];
for (let i = 0; i < nativeTextTracks.length; i++) {
if (nativeTextTracks[i].cues && nativeTextTracks[i].cues.length &&
Copy link
Contributor

Choose a reason for hiding this comment

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

why do you have this condition? you already check for kind so metadata tracks won't be accounted for.
It's better you clear the cues on destroy of the adapter.

Also, side note:

const track = nativeTextTracks[i];

Copy link
Contributor Author

@yairans yairans Jul 15, 2018

Choose a reason for hiding this comment

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

This condition used to ignore old tracks in change media

this._onRecoveredCallback = () => this._onRecovered();
this._onVideoErrorCallback = (e) => this._onVideoError(e);
this._videoElement.addEventListener(EventType.ERROR, this._onVideoErrorCallback);
}

_onFragParsed(): void {
// parse 608/708 captions that not exposed on hls.subtitleTracks
const textTrack = this._playerTracks.find((track) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

do you mean here that we stop in the following case - if we get tracks from hls.js API we check here if we already got them so we remove this listener?
If so why don't also remove the listener in the else clause if you found nativeTextTracks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it will be removed in the next time of FRAG_PARSED

Copy link
Contributor

@OrenMe OrenMe left a comment

Choose a reason for hiding this comment

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

LVGTM - just change it to hlsjs naming convention(just because it sounds better than CEA).

OrenMe
OrenMe previously approved these changes Jul 15, 2018
Copy link
Contributor

@OrenMe OrenMe left a comment

Choose a reason for hiding this comment

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

@yairans fix flow error

OrenMe
OrenMe previously approved these changes Jul 15, 2018
OrenMe
OrenMe previously approved these changes Jul 16, 2018
@yairans yairans merged commit 39e8e09 into master Jul 17, 2018
@yairans yairans deleted the FEC-8390 branch July 17, 2018 13:41
dan-ziv pushed a commit that referenced this pull request Jul 16, 2020
…nd (#67)

* realying on loaded metadata instead of shaka loaded

* change to readyState > 0

readystate=1 means metadata loaded.

on the first play, it already goes to the live edge.

* fix test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants