Skip to content

Commit

Permalink
Use alwaysStreamText to fix native text controls
Browse files Browse the repository at this point in the history
Closes #1332

Change-Id: If57c77202db8f4b2132adc24d26d8fffcad6fa69
  • Loading branch information
joeyparrish committed Mar 21, 2018
1 parent 55271f4 commit cca1954
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
5 changes: 5 additions & 0 deletions demo/asset_section.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,11 @@ shakaDemo.preparePlayer_ = function(asset) {
config.streaming.jumpLargeGaps =
document.getElementById('jumpLargeGaps').checked;

// When we use native controls, we must always stream text.
// See comments in onNativeChange_ for details.
config.streaming.alwaysStreamText =
document.getElementById('showNative').checked;

player.configure(config);

// TODO: document demo app debugging features
Expand Down
14 changes: 11 additions & 3 deletions demo/configuration_section.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ shakaDemo.onConfigInput_ = function(event) {
*/
shakaDemo.onAdaptationChange_ = function(event) {
// Update adaptation config.
shakaDemo.player_.configure(/** @type {shakaExtern.PlayerConfiguration} */({
abr: { enabled: event.target.checked }
}));
shakaDemo.player_.configure({
abr: {enabled: event.target.checked}
});
// Change the hash, to mirror this.
shakaDemo.hashShouldChange_();
};
Expand All @@ -190,6 +190,14 @@ shakaDemo.onNativeChange_ = function(event) {
shakaDemo.controls_.setEnabled(true);
}

// Update text streaming config. When we use native controls, we must always
// stream text. This is because the native controls can't send an event when
// the text display state changes, so we can't use the display state to choose
// when to stream text.
shakaDemo.player_.configure({
streaming: {alwaysStreamText: event.target.checked}
});

// Change the hash, to mirror this.
shakaDemo.hashShouldChange_();
};
Expand Down

0 comments on commit cca1954

Please sign in to comment.