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(hls): Fix type error in lazy-loading #4687

Merged
merged 2 commits into from
Nov 11, 2022
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
7 changes: 7 additions & 0 deletions .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ jobs:
# Install a launcher that can execute a shell script to launch this
npm install karma-script-launcher --save-dev

# Some CI images (self-hosted or otherwise) don't have the minimum Java
# version necessary for the compiler (Java 11).
- uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 11

- name: Build Player
run: python build/all.py

Expand Down
8 changes: 4 additions & 4 deletions lib/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -2160,15 +2160,15 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
// Unless the user has already picked a variant, anyway, by calling
// selectVariantTrack before this loading stage.
let initialVariant = null;
const activeVariantTrack = this.getVariantTracks().find((t) => t.active);
if (!activeVariantTrack) {
const activeVariant = this.streamingEngine_.getCurrentVariant();
if (!activeVariant) {
initialVariant = this.chooseVariant_();
goog.asserts.assert(initialVariant, 'Must choose an initial variant!');
}

// Lazy-load the stream, so we will have enough info to make the playhead.
const createSegmentIndexPromises = [];
const toLazyLoad = activeVariantTrack || initialVariant;
const toLazyLoad = activeVariant || initialVariant;
for (const stream of [toLazyLoad.video, toLazyLoad.audio]) {
if (stream && !stream.segmentIndex) {
createSegmentIndexPromises.push(stream.createSegmentIndex());
Expand All @@ -2189,7 +2189,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
this.startBufferManagement_(rebufferThreshold);

// Now we can switch to the initial variant.
if (!activeVariantTrack) {
if (!activeVariant) {
goog.asserts.assert(initialVariant,
'Must have choosen an initial variant!');

Expand Down
42 changes: 21 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
"eslint-plugin-shaka-rules": "file:./build/eslint-plugin-shaka-rules",
"esprima": "^4.0.1",
"fontfaceonload": "^1.0.2",
"google-closure-compiler-java": "^20220301.0.0",
"google-closure-deps": "https://gitpkg.now.sh/google/closure-library/closure-deps?d7736da6",
"google-closure-library": "^20220301.0.0",
"google-closure-compiler-java": "^20221102.0.0",
"google-closure-deps": "^20221102.0.0",
"google-closure-library": "^20221102.0.0",
"htmlhint": "^1.1.3",
"jasmine-ajax": "^4.0.0",
"jimp": "^0.16.1",
Expand Down
2 changes: 1 addition & 1 deletion third_party/closure-uri/uri.js
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,7 @@ goog.Uri.QueryData.prototype.add = function(key, value) {
// Invalidate the cache.
this.encodedQuery_ = null;

var values = this.keyMap_.hasOwnProperty(key) && this.keyMap_[key];
var values = this.keyMap_.hasOwnProperty(key) ? this.keyMap_[key] : null;
if (!values) {
this.keyMap_[key] = (values = []);
}
Expand Down