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(FEC-7345): only off option appears in text track menu (safari) #148

Merged
merged 2 commits into from
Oct 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/engines/html5/media-source/adapters/native-adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,9 @@ export default class NativeAdapter extends BaseMediaSourceAdapter {
language: textTracks[i].language,
index: i
};
parsedTracks.push(new PKTextTrack(settings));
if (settings.language || settings.label) {
parsedTracks.push(new PKTextTrack(settings));
}
}
}
return parsedTracks;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,16 +238,19 @@ describe('NativeAdapter: _getParsedTracks', function () {
let video;
let track1;
let track2;
let track3;
let nativeInstance;

before(() => {
track1 = document.createElement("track");
track2 = document.createElement("track");
track3 = document.createElement("track");
track1.kind = 'subtitles';
track1.label = 'English';
track1.default = true;
track2.kind = 'captions';
track2.srclang = 'fr';
track3.kind = 'captions';
});

beforeEach(() => {
Expand Down Expand Up @@ -298,6 +301,17 @@ describe('NativeAdapter: _getParsedTracks', function () {
});
});

it('should not return parsed of text track without language or label', (done) => {
video.appendChild(track1);
video.appendChild(track2);
video.appendChild(track3);
nativeInstance.load().then((data) => {
video.textTracks.length.should.equal(3);
data.tracks.filter((track) => track instanceof TextTrack).length.should.be.equal(2);
done();
});
});

it('should return only progressive video tracks before loading', () => {
let tracks = nativeInstance._getParsedTracks();
tracks.length.should.be.equal(2);
Expand Down