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: Ensure native segment metadata track has mode hidden #1550

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
5 changes: 5 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,11 @@
<label class="form-check-label" for="forced-subtitles">Use Forced Subtitles (reloads player)</label>
</div>

<div class="form-check">
<input id="native-text-tracks" type="checkbox" class="form-check-input">
<label class="form-check-label" for="native-text-tracks">Use native text tracks (reloads player)</label>
</div>

<div class="input-group">
<span class="input-group-text"><label for=preload>Preload (reloads player)</label></span>
<select id=preload class="form-select">
Expand Down
7 changes: 5 additions & 2 deletions scripts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,8 @@
'use-mms',
'preload',
'mirror-source',
'forced-subtitles'
'forced-subtitles',
'native-text-tracks'
].forEach(function(name) {
stateEls[name] = document.getElementById(name);
});
Expand Down Expand Up @@ -528,7 +529,8 @@
'network-info',
'dts-offset',
'exact-manifest-timings',
'forced-subtitles'
'forced-subtitles',
'native-text-tracks'
].forEach(function(name) {
stateEls[name].addEventListener('change', function(event) {
saveState();
Expand Down Expand Up @@ -603,6 +605,7 @@
liveui: stateEls.liveui.checked,
enableSourceset: mirrorSource,
html5: {
nativeTextTracks: getInputValue(stateEls['native-text-tracks']),
vhs: {
overrideNative: getInputValue(stateEls['override-native']),
experimentalUseMMS: getInputValue(stateEls['use-mms']),
Expand Down
2 changes: 2 additions & 0 deletions src/playlist-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ export class PlaylistController extends videojs.EventTarget {
label: 'segment-metadata'
}, false).track;

this.segmentMetadataTrack_.mode = 'hidden';

this.decrypter_ = new Decrypter();
this.sourceUpdater_ = new SourceUpdater(this.mediaSource);
this.inbandTextTracks_ = {};
Expand Down
20 changes: 20 additions & 0 deletions test/playlist-controller.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7729,3 +7729,23 @@ QUnit.test('ManagedMediaSource startstreaming and endstreaming events start and

mms.restore();
});

QUnit.module('Native tracks', {
beforeEach(assert) {
this.playerOptions = {
html5: {
nativeTextTracks: true
}
};
sharedHooks.beforeEach.call(this, assert);
this.pc = this.playlistController;

},
afterEach(assert) {
sharedHooks.afterEach.call(this, assert);
}
});

QUnit.test('Native text track mode is hidden', function(assert) {
assert.strictEqual(this.pc.segmentMetadataTrack_.mode, 'hidden', 'track mode is hidden');
});
Loading