From 2d95346ec7f740b3625f9511e3e1608faf698784 Mon Sep 17 00:00:00 2001 From: Joey Parrish Date: Thu, 15 Mar 2018 09:44:52 -0700 Subject: [PATCH] Use alwaysStreamText to fix native text controls Closes #1332 Change-Id: If57c77202db8f4b2132adc24d26d8fffcad6fa69 --- demo/asset_section.js | 5 +++++ demo/configuration_section.js | 12 ++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/demo/asset_section.js b/demo/asset_section.js index f2fd2823c0..30a06511d3 100644 --- a/demo/asset_section.js +++ b/demo/asset_section.js @@ -258,6 +258,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 diff --git a/demo/configuration_section.js b/demo/configuration_section.js index 677ec285d4..7af39a2532 100644 --- a/demo/configuration_section.js +++ b/demo/configuration_section.js @@ -165,9 +165,9 @@ shakaDemo.onConfigInput_ = function(event) { */ shakaDemo.onAdaptationChange_ = function(event) { // Update adaptation config. - shakaDemo.player_.configure(/** @type {shakaExtern.PlayerConfiguration} */({ + shakaDemo.player_.configure({ abr: {enabled: event.target.checked} - })); + }); // Change the hash, to mirror this. shakaDemo.hashShouldChange_(); }; @@ -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_(); };