Skip to content

Commit

Permalink
fix: Ensure native segment metadata track has mode hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
mister-ben committed Oct 31, 2024
1 parent 9f1c4ad commit fd19b3f
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 2 deletions.
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');
});

0 comments on commit fd19b3f

Please sign in to comment.